Report and more summary value

I need to build a report to show per each product (obj_id) number of sales ( a
simple COUNT will do), total income
from the sales and number of units sold
(quantity). The following works OK, but I use DISTINCT and don't feel
comfortable
with future performance.
WITH myMainTable AS
(SELECT 1 AS obj_id, 'A'
AS obj_desc
UNION ALL
SELECT 2,'B'
UNION ALL
SELECT 3,'C'
UNION
ALL
SELECT 4,'D'
UNION ALL
SELECT 5,'E'
UNION ALL
SELECT
6,'F'),
myDataTable AS (
SELECT 1 AS obj_id,
3 AS qnty,
45 AS
total_price
UNION ALL
SELECT 1,4,87
UNION ALL
SELECT
1,1,10
UNION ALL
SELECT 1,40,751
UNION ALL
SELECT 2,10,8
UNION
ALL
SELECT 2,100,87
UNION ALL
SELECT 3,6,9)
SELECT DISTINCT
m.obj_id,
m.obj_desc,
SUM (d.total_price) OVER (PARTITION BY m.obj_id)
AS total_income,
SUM (d.qnty) OVER (PARTITION BY m.obj_id) AS
total_qnty,
COUNT(d.obj_id) OVER (PARTITION BY m.obj_id) AS
total_sales
FROM myMainTable m
JOIN myDataTable d
ON d.obj_id =
m.obj_id

Try
SELECT m.obj_id,
m.obj_desc,
SUM (d.total_price)
as total_income,
SUM (d.qnty) 
AS total_qnty,
COUNT(d.obj_id) 
AS total_sales
FROM myMainTable m
JOIN myDataTable d
ON d.obj_id = m.obj_id
group by m.obj_id, m.obj_desc
Ahsan Kabir Please remember to click Mark as Answer and Vote as Helpful on posts that help you. This can be beneficial to other community members reading the thread. http://www.aktechforum.blogspot.com/

Similar Messages

  • Can i pass plsql table as parameter in a report and display the values

    Hi.I have a form with five text items.
    Also inside the form I have a button and when I push the button the trigger fires(WHEN BUTTON PRESSED) and the values of the form passed and display in the report.Is it possible to have in the form a detail for example with three rows and three columns and with some way(mayby as plsql table) pass all the parameters from the form to report and then display in the report?I asume the report is a tabular report.
    Thanks in advance Panagiotis.

    Hi Nigel,
    By default, SharePoint will display folder icon for document sets in the search results.
    If you need to change this icon in search results, then you can modify the display template for document sets.
    http://blogs.technet.com/b/tothesharepoint/archive/2013/09/04/understand-how-search-results-are-displayed-in-sharepoint-server-2013.aspx
    How did you set query in the Result Source?
    I tested the query below in the result source in my environment, and it worked fine.
    {searchTerms}ContentTypeID:0x0120D520*
    I recommend to check if the document sets have been crawled in crawl log.
    If not, please run a full crawl in Search Service Application and then check the results.
    Best regards.
    Victoria
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • Aging report and Control account value not matching

    Hi All
    The value what i am getting from   Vendor liabilities aging and Control account is not matching  for the same dates, all my parameters or selection criteria are same
    Same report if i am taking for the current date it giving correctly,
    If i am trying for a previous day the problem is happening
    How can i solve this issue

    Hi,
    Please check if the transactions are done for different Control Accounts and both the account balances are included in the Aging Report.
    Also, check that ALL the customers/vendor groups are taken.
    Make sure that you are running the backdated aging with the checkbox as mentioned in the Note 800294.
    If still facing problems may be you can provide with more details as to what the control account balances and what is the Aging, difference.
    PS: Check if there is any manual journal entry is created in the control account?
    Kind Regards,
    Jitin
    SAP Business One Forum Team

  • COPA report and purchase order value mismatched

    Dear Experts,
    In copa report ke30 COGS value come Rs 12129805 and in purchage order it shown 767537.34 which was assigned the sales order.
    In KE33 report i checked VRPRS was th value field which data flowing to copa and input parameter recoed type B to F.
    VPRS condition type assigned wit VRPRS value field in ke4i(Assignment of SD to copa value field).
    Please suggest why data coming mismatch.
    Regards,
    Debashis

    Hi,
    There could be difference in material prices mentioned in the PO,
    and at the time of PGI/billing. check material prices
    Please check material prices for those material for the period.
    Regards,
    Kedar

  • WIP report and WIP gl value differ

    Dear all,
    When I execute KKAO report for a particular month, the WIP values for some orders differ from the WIP Gl Balance for the particular period.
    Please suggest me why this difference occurs?
    Thanks & Regards,
    A.Anandarajan.

    Hi Dasuni ,
    As you might be aware , whatever results the system computes for Work in Process for partially delivered orders and for Variances for fully delivered orders are posted to Financial Accounting using Settlement. If you look at the Production order settlement rule , you will have PER and FUL settlement rules described wherein if in one specific period , you do not settle the order , the same may be settled in the next period by virtue of the FUL indicator. So, in your case , it is a clear indication that one such orders was not settled during May but was settled during June. That is what apparently I can make out of this.
    Regards,
    Venkat.

  • AV Scripts, Free form docs, Breakdown reports and more...

    Hi there,
    We've posted an update to Adobe Story that includes exciting features like AV Scripts, Free form documents, and Breakdown reports among other things.
    Check out the latest release notes to know more.
    - Adobe Story team

    This is a very very nice update, especially all the breakdown reports that I was missing badly.

  • SUBMIT and return the value of that report into internal table

    Dear all,
    I have a requirement. I want to submit a report and return the value of that report into my internal table.
    How to do this.
    Pl. guide.

    Hi Vidhya,
    Below links from SAP help will resolve your issue.
    http://help.sap.com/saphelp_nw04/Helpdata/EN/fc/eb3bde358411d1829f0000e829fbfe/content.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3bd1358411d1829f0000e829fbfe/content.htm
    Edited by: Harsh Bhalla on Jan 2, 2010 11:54 AM

  • Calling a report and passing values!!

    Hi Experts,
    i have a requirement. I have a report [zrep1] with billing doc field and shipment field on the selection screen.
    The logic for billing document is written. Im writing logic for shipment numbers. I am finding the billing documents of delivaries for each shipment.
    I want to pass those billing documents as input to the same report program [zrep1] for the existing billing document code to get the output.
    How to call the same report and pass the values from internal table as input to it.
    Please suggest the way to proceed. i knw it is possible.
    Thanks in advance.
    Edited by: Craig Cmehil on Jul 3, 2008 3:30 PM

    Hello,
    Try this:
    The program report1 has a stand-alone selection screen with the screen number 1100. In the program report2, an internal table with row type RSPARAMS and a ranges table are filled for this selection screen. These are transferred at SUBMIT together with a single condition.
    Program accessed
    REPORT report1.
    DATA text TYPE c LENGTH 10.
    SELECTION-SCREEN BEGIN OF SCREEN 1100.
      SELECT-OPTIONS: selcrit1 FOR text,
                      selcrit2 FOR text.
    SELECTION-SCREEN END OF SCREEN 1100.
    Calling program
    REPORT report2.
    DATA: text       TYPE c LENGTH 10,
          rspar_tab  TYPE TABLE OF rsparams,
          rspar_line LIKE LINE OF rspar_tab,
          range_tab  LIKE RANGE OF text,
          range_line LIKE LINE OF range_tab.
    rspar_line-selname = 'SELCRIT1'.
    rspar_line-kind    = 'S'.
    rspar_line-sign    = 'I'.
    rspar_line-option  = 'EQ'.
    rspar_line-low     = 'ABAP'.
    APPEND rspar_line TO rspar_tab.
    range_line-sign   = 'E'.
    range_line-option = 'EQ'.
    range_line-low    = 'H'.
    APPEND range_line TO range_tab.
    range_line-sign   = 'E'.
    range_line-option = 'EQ'.
    range_line-low    = 'K'.
    APPEND range_line TO range_tab.
    SUBMIT report1 USING SELECTION-SCREEN '1100'
                   WITH SELECTION-TABLE rspar_tab
                   WITH selcrit2 BETWEEN 'H' AND 'K'
                   WITH selcrit2 IN range_tab
                   AND RETURN.
    Regards.

  • Call tcode from alv report and passing  group of values

    hi all .
    i want to call tcode from alv report and passing an internal table or group of values to a selection option of that t code ? how
    ex. passing group of GL to fbl3n and display the detials of all .
    thank you

    Dear,
    You have done a small mistake
    --> rspar_line-option = 'EQ'.
         rspar_line-HIGH = PDATE-HIGH.
    u r passing "high" value and in "option u r passing "EQ" so how it will work!!!
    So if u r passing only 1 date or more dates like 01.01.2010 , 15.02.2010 , 10.03.2010 then pass
    rspar_line-selname = 'SO_BUDAT'.
    rspar_line-kind = 'S'.
    rspar_line-sign = 'I'.
    rspar_line-option = 'EQ'.
    rspar_line-LOW = PDATE-HIGH.
    APPEND rspar_line TO rspar_tab.
    or if u r passing low & high date means in range like 01.01.2010 to 30.01.2010, then pass
    rspar_line-selname = 'SO_BUDAT'.
    rspar_line-kind = 'S'.
    rspar_line-sign = 'I'.
    rspar_line-option = 'BT''.
    rspar_line-LOW = PDATE-LOW.
    rspar_line-HIGH = PDATE-HIGH.
    APPEND rspar_line TO rspar_tab.
    try above code , hope it helps...
    i think u cannot use "call transaction using bdcdata" in ur case bcoz as u said in ur 1st post u want to display the details of all but still if u want to use then u should pass all parameters in  loop.
    PROGRAM
    DYNPRO
    DYNBEGIN
    FNAM
    FVAL
    ex:-
    LOOP AT GT_TEMP INTO GS_TEMP.
    CLEAR bdcdata_wa.
    bdcdata_PROGRAM = 'SAPXXXX'.
    bdcdata_DYNPRO = '1000'.
    bdcdata_DYNBEGIN = 'X'.
    bdcdata_wa-fnam = '''.
    bdcdata_wa-fval = ''.
    APPEND bdcdata_wa TO bdcdata_tab.
    CLEAR bdcdata_wa.
    bdcdata_PROGRAM = ''.
    bdcdata_DYNPRO = ''.
    bdcdata_DYNBEGIN = ''.
    bdcdata_wa-fnam = 'SD_SAKNR'.
    bdcdata_wa-fval = GS_TEMP-GLACCOUNT.
    APPEND bdcdata_wa TO bdcdata_tab.
    CLEAR bdcdata_wa.
    bdcdata_PROGRAM = ''.
    bdcdata_DYNPRO = ''.
    bdcdata_DYNBEGIN = ''.
    bdcdata_wa-fnam = 'BDC_OKCODE'.
    bdcdata_wa-fval = 'XXX'.
    APPEND bdcdata_wa TO bdcdata_tab.
    ENDLOOP.
    try above code if u r using call transaction...
    Edited by: mihir6666 on Jul 9, 2011 3:10 PM
    Edited by: mihir6666 on Jul 9, 2011 3:11 PM
    Edited by: mihir6666 on Jul 9, 2011 3:13 PM

  • Any standard report to show WBS,settlement, asset no and asset cost/value

    Hi All,
    Please advice . Is there any standard report to show WBS,settlement, asset no and asset cost/value ? I tried tcode kosrlist_pr but it does not show asset cost/value.. it shows only WBS,settlement and asset no.
    Thank you.
    Best Regards,
    Nies

    Dear,
    der is no such standard report to show WBS,settlement, asset no and asset cost/value as perv my knowlwdge. so do one thing select one standard report which is more similar to standard report to show WBS,settlement, asset no and asset cost/value but some of like asset no or asset cost or some other values not reflecting in that std report. den u take the Table name and field name of that particular fields which u wann reflect in the report. use the logic of STD TC of SAp which more similar to which u wanna preapre the New TC. tae help of Abaper. tell ur querry and content of ur report . he will definately do it
    if ur get my ans reward with points
    Regards
    Rakesh

  • E-Mail Summary Report and Detailed Report Automatically

    Hi, I have just started a new job (1st IT job since leaving college) and I've been told that our Small Business Server 2011 used to email a Summary Report directly to a specified email address, as well as a weekly Detailed Report to the same email address,
    but that has stopped sending reports now. How do i make sure that the reports are automatically generated and sent out via email to the specified address. Any help would be great.

    Hi,
    Based on your description, I understand that there some issue occurred in Report feature in the SBS 2011.
    On current situation, please refer to following steps and troubleshoot this issue. Then check if can help you.
    1. Login the SBS server. Please open Windows SBS Console and select
    Reports tab. In the Reports panel, select a report (Summary or Detailed), then View report properties. In Report Properties page, please select
    E-Mail Options to check if had added the correct user account or e-mail address. Also please select Schedule tab, and check if had configured correctly.
    2. Then manually click
    Generate report option in Tasks. Please check if successfully generated the report. If not, please refer to following TechNet article and repair Monitoring and Reporting features in the SBS server. Then monitor the result.
    Repair Monitoring and Reporting Features
    in Windows Small Business Server 2011 Standard
    3. If generated the report successfully, please manually click
    Generate report and e-mail report option in Tasks. Then check if run successfully. Or any error message occurred?
    4. If this issue still exists, please refer to following path: C:\Program Files\Windows Small Business Server\Logs\MonitoringServiceLogs and check if there has some log files
    which be related to Report (Summary or Detailed). If has, please check if can find some more clues. Meanwhile, please open Event Viewer and check if find some relevant errors. Those may hope us to go further analyze.
    If any update, please feel free to let me know.
    Hope this helps.
    Best regards,
    Justin Gu

  • Can I run a Unique Clients and Users Summary report customized by both floor area and SSID?

    In Cisco Prime, can I run a Unique Clients and Users Summary report customized by both floor area and SSID?

    Allright guys. I appreciate the quick responses. I've worked a lot in CR however i am not understanding the solution so I'd appreciate if you can dumb it down for me. If i understand it correctly you guys are suggesting to make a formula, that either return my group by string (which is a formula in my report) or the Quantity. I tried writing a formula like this
    if ({@param} = 1 then
    GroupName ({@GroupBy})
    else
    {NetPNL.GrossAfterAdj}
    but it seems like CR does not allow you to return 2 different data types. Even if it had worked i would not know what to do from there. Can anyone please dumb it down for me. To make my situation more clear below is an example of how my data is..
    MN 100
    MN 200
    MN 50
    CA 300
    CA 500
    when the data shows in the report, its grouped by state, so it comes out like
    MN 350
    CA 800
    I want the users to decide whether they want it sorted by state  (ascending)
    CA 800
    MN 350
    or Total quantity (asc)
    MN 350
    CA 800

  • Display Report Level Filter value and Input Controls Value

    Hi,
    Please let me know how to display Report Level Filter value and Input COntrol values in the report.
    I have 2 tabs in the WebI Report. The first tab has the summary details about the other tabs like reprot desc, prompt values, reprot filter values,etc.
    In the 2nd tab I have the actual report which has input controls defined, prompt values and global level report filters.
    Can anyone please tell me how to display the Report level filter values and the Input Control values in the first tab report.
    For ex: Tab 2 has a Report level filter: Region = NA
    I need to display in Tab 1 in as Region: NA
    I used the function ReportFilterSummary but that is giving me other details, I want only the object name and the value.
    Also how to dispaly the Input Control values in the tab 1.
    Please let me know if you have any suggestions for this issue.
    Thanks

    did you try
    =ReportFilter([Year])
    if you are making report filter over the year, it will return the value of the filter
    by the way, the filter should be applied over all the report not to a specific block to be able to get the correct value
    the Input control also considered as report filter, only if you're applying them on the level of the report, if you applying an input contron over a specific block or chart, you will not get the values for ReportFilter
    good luck

  • To customize Inventory Summary Value Report

    Hi
    I want to update the Inventory Summary Value Report to add another value in the parameter region.
    Pls help!

    I assume you want a new parameter.
    For that, you will have to customize the report.
    1) In the custom report, add the new parameter and the logic to use the new parameter.
    2) Copy the report to the server
    3) Create new conc. executable and program.
    4) Assign the new program to a request group.
    Now you can run the new report with the additional parameter.
    See http://oracle.anilpassi.com/customization-of-reports-in-oracle-apps.html for detailed steps.
    Sandeep Gandhi

  • Navigate between 2 reports and pass values between 2 different columns

    Hello
    I have a question about navigating from 1 report to another while passing the value from column 1 to column 2 in the second report...
    In OBIEE 11G, I create action link on report 1, column 1 and this action link is navigate to BI Content and the destination is report 2. Now report 2 has column 2, which is an alias of column 1 from report 1, from user's point of view they are the same, but from OBIEE point of view they are different.
    My action link is able to navigate to report 2, however, the value in column 1 which I clicked to execute the navigation, does not get passed to column 2 in report 2..
    Is there a way around this issue?
    Let me know if I need to provide more clarification
    Thanks

    Thank you Anirban
    I think this is the best solution you just provided.The current post and the post at below looks same
    Navigate from report to dashboard and  pass values between different column
    is it not answered?
    Thanks :)
    Edited by: Srini VEERAVALLI on May 7, 2013 3:07 PM

Maybe you are looking for

  • Settings for 103/105 movt type

    I want to follow the route of 103 and 105 for import vendors and 101 for domestic vendors. What are the settings that are to made for the 103 and 105 movement type and how can i control the same via vendor or Purchase order. That is system should not

  • Credit Limit related Issue

    The problem i am facing is that any amount received from the customer as security deposit or down payment  is treated in SAP as specialGL transaction and it is not captured by the system for the purpose of Credit Limit Check . Since there is no credi

  • Ingestion Performance with Out-of-line on Large Schema

    I have a large and complex schema consisting of 5 XSD's and few hundred complex types and a few thousand elements. This schema will be used for loading files ranging from 50mb to 650mb. Since there are circular references and self references, I have

  • Performance considerations with mapping outside the BPE

    Hello together, we have an Integration Process with 2 more or less complex transformations steps (i.e. Message Merging). Since the overall performance is rather poor, we consider to let the mapping take place outside the IP. This means we would have

  • Problem in viewing a movie

    when i download a movie in iTunes and if it is viewed, a green blank screen is being appeared. What is the problem? But I can view a movie in you tube.