Summation query

Hello,
I have a report which shows the spend amount for the vendors for the last 12 months. I am trying to add a column which shows summation of the amounts by vendor.
Now it shows only the total for each month.
How can I also show the totals for the vendors ( amount for each vendor) on the same report.
Thanks,

Amt-jan 2011             Amt u2013feb 2011                   Total vendor
Vendor 1                                                                                ?
Vendor 2                                                                                ?
                      Total jan 2011            Total  feb 2011     
I have the results in this format as of now. I want to get the third column total vendor. Still not able to figure that out.
How would i do aggregation. Can you please guide me with this.

Similar Messages

  • Sort/filter datablock based on procedure that return table type

    Hi All,
    I’ve got datablock based on procedure that return table type. In the form I have to provide ‘filter and sort records’ functionality. Previously, using tables/views based datablocks, I’ve done that by using:
    -- filter
    SET_BLOCK_PROPERTY (L_BLOCK_NAME, DEFAULT_WHERE, L_WHERE_CLAUSE);
    -- sort
    SET_BLOCK_PROPERTY(L_BLOCK_NAME ,ORDER_BY, L_ORDER_BY_CLAUSE);
    -- and then
    EXECUTE_QUERY;
    It doesn’t work with procedure that return table type. How I can do that?
    Bartek

    I agree with Andreas, from the sample you have given us, I don't see any reason why you could not merge these queries into a single UNION/UNION ALL query. Also, I would add your summation query to your main query to eliminate this extra step. The result would look something like:
    SELECT DISTINCT
         pih.id
         ,d.document_id
         ,pih.doc_serial_no
         ,pih.purch_invoice_date
         ,oh.company_name
         ,(SELECT NVL(SUM(amount),0)
              FROM "YOUR TABLE HERE" yth
              WHERE yth."YOUR COLUMN HERE" = pih.id) AS sum_amount
      FROM "YOUR TABLES HERE"
    WHERE "YOUR JOIN CONDITIONS HERE"
    UNION ALL
    SELECT DISTINCT
         sih.id
         ,d.document_ind
         ,sih.doc_serial_no
         ,sih.sales_invoice_date
         ,sih.company_name
         ,(SELECT NVL(SUM(amount),0)
              FROM "YOUR TABLE HERE" yth
              WHERE yth."YOUR COLUMN HERE" = sih.id) AS sum_amount
      FROM "YOUR TABLES HERE"
    WHERE "YOUR JOIN CONDITIONS HERE"
    [/code]
    Hope this helps.
    Craig...
    +If a response is helpful or correct, please mark it accordingly+
    Edited by: CraigB on Feb 23, 2010 1:39 PM
    It appears the CODE tags are not working as well as the URL tags.  :(                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Poor Response Time- Total on a column for n number of rows

    I have a table with column cost on my custom OAF page.
    When I query for configuration it returns me many rows. so I have set the default rows for table = 10 and then I neatly have next button to go to other rows.
    I have enabled totalling on cost column.
    Row for Total appears showing sum for the costs only on that page( for only 10 rows). I click for next from drop down , and I see total for the costs for the second page.
    Ex:
    table has 17 rows and
    page 1 :
    total row at the end saying 1000.00
    page 2 :
    total = 1500.00
    I want to display Total Cost by summing up the costs for say 300 items returned by the query on all the pages , in above case 2500.00.
    I thought of a way to do it ;
    I added a sumVO with query "select sum(...) from table" .
    Added a new region in my page , added a messageStyleText based on the sumVO, and pulled the total cost in.
    It shows me the right result, but my problem is performance.
    It is getting very slow. I am using the same query as for displaying the results in table, but summing on cost column.
    Can I avoid writing the sum query and do it programmatically in OAF ??
    Thanks in advance.

    Even if you use programmatic approach, what do you think program will do?
    Program has to fetch all the rows in the middle tier and sum it up using for loop. No way its going to solve your problem.
    First find out the reason for the slow performance using Trace option. and fix the query.
    If your not able to fix it, try materialized view for the summation query.
    To take sql trace for OAF page refer this link infor http://prasanna-adf.blogspot.com/2009/01/sql-trace.html
    --Prasanna                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Summation button missing in abap query ..

    Hi,
    How to activate summation button in Abap query..
    Problem is ,we had instaled some service packs in our production system..
    After this we found that ,when we run one of our Abap query (with transaction code) in output  summation button is not there.
    Can you please let me know  how can we activate this summation button..
    Thanks,
    Parnith..

    Hi Amit,
    Thanks For Reply..
    Even though there are  summables in list ,summation button is deactive..( It is not being dispalyed on output list)
    Can you please suggest the process to activate this summation button..
    Thanks
    Parnith

  • Local Calculation (Summation) in query doesn't display correctly in web

    Hi All,
    I have been working on a complicated query where I have formulas that perform calculations.  I then Hide these formulas and use them in another formula for further calculations.  The new calculations I then use local summation to basically just add the columns values and come up with an overall result.  Works perfect and is displayed perfectly.
    Problem is now in the web.  Either using a Pie Chart or just simply an Analysis item, the values are not displayed correctly at all.  The Pie Chart only displays the first row of data (not the overall result...which is a local summation...which is what I would prefer) and suprised that the Analysis item doesn't basically display what the query does.  I'm guessing it has to do with this local calculation.
    Can someone explain this behavior?
    Thanks.

    Anyone any ideas?

  • SAP Query- Is summation possible

    Dear All,
    Pls let me know if we can do summation in SAP Query to get a count on positions for example.
    Eg. If i ve say 25 positions in the system pulled out by through Query, can i be able to sum them up saying the count is "25" in SAP Query.
    Points would be awarded.
    Thanks.

    will put up the example as below:
    the query pulls out a report on the existing positons as below:
    Object Type    Start Date       End Date         Object Name
       S                01.01.2005     31.12.9999         HR
       S                01.01.2005     31.12.9999         Marketing
       S                01.01.2005     31.12.9999         Finance
       S                01.01.2005     31.12.9999         ABC
    Now, I want the report to diplay the count of the position as "4" somewhere above.
    Is this possible in to get this count in standard report or query?

  • Summation of rounded values in query designer

    Summation of rounded values
    Hello,
    we would like to know if there is a function which we could insert into e fixed structure that works like the query function  Summation of rounded values.
    It seems like it doesn' t exist....
    Davide
    "Example
    Summation of rounded values
    The example below shows the values of a simple query where sales have been set with a scaling factor of 1,000.
    Customer
    Sales
    EUR 1,000
    Customer 1
    2,246
    Customer 2
    2,126
    Total
    4,372
    If you now reduce the number of decimal places, the values are rounded:
    Customer
    Sales
    EUR 1,000
    Customer 1
    2,25
    Customer 2
    2,13
    Total
    4,37
    You can see that the total seen locally is not the value that you would expect. This value was calculated first then displayed and then the value was rounded.
    If you activate the Summation of rounded values function, the value is rounded first, then calculated, then displayed. The query then appears as follows:
    Customer
    Sales
    EUR 1,000
    Customer 1
    2,25
    Customer 2
    2,13
    Total
    4,38"

    Hi,
    If you want to sum up the value of pswdt follow the sample which i handled with select statement;
    SELECT MATNR  SUM( LSMNG ) SUM( WEMNG )
              INTO (V_MAT, V_LSMNG, V_WEMNG)
              FROM S012
              WHERE MATNR = WA_MAT-MATNR
              GROUP BY MATNR.

  • Query on Exchange rate field causing summation

    Hi
    I have used Sales Item cube.  When i query in BEX  on Sales order, item no and exchange rate it is perfect.  But when i query only on Sales order no and Exchange rate.  The exchange rate displayed is cumulative of all Exchange rates in items.
    Ex.  Sales order   item  Ex-Rate
            15000001     0001  4.1
            15000001     0002  4.1
    But when i query on SO and Ex-rate
        Sales order    Ex-Rate
            15000001    8.2
    Instead should show me as 4.1 only.
    Any help is higly appreciated.
    Thanks.
    A

    Hi,
    Exchange rate is the type of key figure that is difficult to report on. Even for the same order #, there may be different exchange rates applicable to different lines. Try to get the basic logic to apply exchange rates, the extractor may already providing the rates....if the rates are same for all line items or below that, then probably you can display the average ( try average of non-zero rows).
    But I would suggest to derive the rates dynamically from the displayed value (after conversion)  and the database value.
    Hope this helps.

  • Difference between  aggregation and calculation tab in BEx Query Designer

    HI,
    I am using BEx Query Designer for my report, for the key figures in the coloumn area i slected one numeric key figures, in  the properties tab i found aggregation tab and calculation tab.
    I need to sum up the total values for that particualar coloumn, when i used calculation tab i found to sum all the values for a particular coloumn, then what is the use the aggreagation tab?
    I not able to used that Aggregation tab it is showing as a hidden fields...
    can any one tell me whats the exact difference between these tabs and when we need to use which tab?
    With Regards,
    Thanesh Kumar.

    Hi Thanesh Kumar,
    I moved this thread from forum Data Warehousing to Business Explorer since it is a query related question (as SDN moderator).
    I could explain to you the difference between these two tabs.
    For "calculation" tab, it changes the display of result and does not change the calculation logic.
    It means that, if this key figure is used further in formula, still the original number (without "calculation" tab setting)  is used for further formula calculation.
    For "aggregation" tab, it changes the real calculation logic.
    The system takes the setting as the aggregation rule for records.
    The most common aggregation rule is of course summation. If you set to e.g. Average here, the system does the
    Average instead of summation when aggregating records. And the Average value will be taken for calculation
    in further formulas or other calculations.
    For "aggregation" tab, you could only use it for CKF (calculated key figure) or formula and you could not use it for
    a basic key figure. That should be the reason why you see it greyed-out.
    Regards,
    Patricia

  • Key Figure Aggregate in Bex Query

    Hi Gurus
    I am using BI7.0; but 3.5x BEx tools
    I am loading 6 fields from a flat file.  I am loading data for tickets.  I have create an InfoObject that counts the number of tickets.  No problem.  Also I also have key figures that I am assigning the same value to all Charactersitics: 10,30 per ticket.
    The Key figures are (Sum) with a Summation aggregation type. 
    In my Query, the 10,30 aggregate up based on the number of tickets (characteristic) that are available.
    Question:  How do I remove/stop my key figures from aggregating up (sums) the values of 10, 30 based on the charactersitic?  I want only 10, 30 to be present regardless of the number of tickets (constant value applied to the key figure).
    Should I change my aggregation type?  If so, to what?  I see a number of options, such as Last Number, No aggregation, etc
    Thank you

    I found a solution to my requirement.

  • Key Figure Aggregate in Bex Query based on Charactersitic

    Hi Gurus
    I am using BI7.0; but 3.5x BEx tools
    I am loading 6 fields from a flat file.  I am loading data for tickets.  I have create an InfoObject that counts the number of tickets.  No problem.  Also I also have key figures that I am assigning the same value to all Charactersitics: 10,30 per ticket.
    The Key figures are (Sum) with a Summation aggregation type. 
    In my Query, the 10,30 aggregate up based on the number of tickets (characteristic) that are available.
    Question:  How do I remove/stop my key figures from aggregating up (sums) the values of 10, 30 based on the charactersitic?  I want only 10, 30 to be present regardless of the number of tickets (constant value applied to the key figure).
    Should I change my aggregation type?  If so, to what?  I see a number of options, such as Last Number, No aggregation, etc or can I override this in my Query property?
    Thank you

    Hi Client
    I would like to know how to avoid aggregation of a key figure in Bex 3.5?
    Thanks
    GS

  • Key figure summation for KF IN different cube of a MP

    Hi,
       I need to design a report on a Multiprovider. MP is based on two Cube Cube1 and Cube2.
       Cube 1 has field item and key figure total quatity.  Cube 2 has field item and key figure  quatity1.
       I need a report which will show
                      Item  quantity1  Total quantity   Percentage
    Percentage = (quantity1/total quantity)*100.
    I am surprised that percentage is X, though other two KF has value.
    Is it the case that it is not possible to make summation, subtraction or any opeartion between two KF in different cube.
    Could you please guide how to create percentage between two KF in different cube in a MP.
    Regards
    Deep

    Hey Deep,
    First confirm me what I understand... First you created a Mp which contains both KFs... Total quantity and Quantity one then in BEx query designer you created report in which you created a formula named "Percentage" and formula was (quantity1/totalquantity)*100... and in analyzer you are getting X instead of values. Then first try to check the properties of Formula (Percentage) in BEx query designer if decimal places etc are implemented and correct and second check if analyzer is reading these values as CHAR or Keyfigures and that you can check if there is a green arrow on left corner of each cell on both column's individual cells. If the green arrow kinda symbol is present there then it means that analyzer is not reading the values as CHAR thats why it is not doing any operation on both columns. Check these and let me know.

  • How to hide some fields in ABAP Query

    Hi,
    My ABAP Query has a long list of extracted fields. I wanted to set some of these output to "HIDE".
    This allow User the flexibility to decide what fields to show.
    How can I set the field to "HIDE" in my query?
    Thanks
    bye

    Hi Tim,
    You can do this by setting the Report layout variant in following steps:
    1. First define the parameter on selection screent for report variant.
    2. Data decelaration for variant.
    3. Value request to get already present variants on report:
    4. If doesn't choose the layout take out the default report layout.
    5. Initialize the report variant.
    6. Apply the variant to the REUSE_ALV_GRID_DISPLAY funtion module.
             Here to generate report variant first to open report output and then as per according to user set the layout of report using the layout icon of ALV with summation on value fields (as required) and create layout name.
    *Data Deceleration as below:
    Data :g_save(1) TYPE c,
    **      g_default(1) TYPE c,
    g_exit(1) TYPE c,
    gx_variant TYPE disvariant,
    g_variant TYPE disvariant.
    *First Define the parameter to give layout of Report variant.
    SELECTION-SCREEN BEGIN OF BLOCK 3 WITH FRAME TITLE text-003.
    PARAMETERS: p_vari TYPE disvariant-variant.
    SELECTION-SCREEN END OF BLOCK 3.
    * Process on value request
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_vari.
    PERFORM f4_for_variant.
    * Selection-Screen Checking
    AT SELECTION-SCREEN.
    PERFORM pai_of_selection_screen.
    INITIALIZATION.
    w_repid = sy-repid.
    PERFORM variant_init.
    * Get default variant
    gx_variant = g_variant.
    CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
    EXPORTING
    i_save     = g_save
    CHANGING
    cs_variant = gx_variant
    EXCEPTIONS
    not_found  = 2.
    IF sy-subrc = 0.
    p_vari = gx_variant-variant.
    ENDIF.
    FORM f4_for_variant .
    CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
    EXPORTING
    is_variant = g_variant
    i_save     = g_save
    IMPORTING
    e_exit     = g_exit
    es_variant = gx_variant
    EXCEPTIONS
    not_found  = 2.
    IF sy-subrc = 2.
    MESSAGE ID sy-msgid TYPE 'S'      NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    **  ELSE.
    **    IF g_exit = space.
    **    ENDIF.
    ENDIF.
    ENDFORM.                    " f4_for_variant
    FORM pai_of_selection_screen .
    IF NOT p_vari IS INITIAL.
    MOVE g_variant TO gx_variant.
    MOVE p_vari TO gx_variant-variant.
    CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'
    EXPORTING
    i_save     = g_save
    CHANGING
    cs_variant = gx_variant.
    g_variant = gx_variant.
    ELSE.
    PERFORM variant_init.
    ENDIF.
    ENDFORM.                    " pai_of_selection_screen
    FORM variant_init .
    CLEAR g_variant.
    g_variant-report = w_repid.
    ENDFORM.                    " variant_init
    **While Showing report pass the variant :::
    g_save = 'A'.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    i_callback_program = w_repid
    i_structure_name   = 'IT_MAIN'
    is_layout          = i_layout
    is_print           = i_print
    it_fieldcat        = i_fieldcat[]
    it_events          = i_events[]
    i_save             = g_save
    is_variant         = g_variant
    TABLES
    t_outtab           = it_main
    EXCEPTIONS
    program_error      = 1
    OTHERS             = 2.
    IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    Many Thanks / Himanshu Gupta

  • WebI aggregation on top of BW query

    Hi,
    I'm having problems with aggregated values shown on WebI when using percentage values.
    As an example:
                                                                           Actual 3    Actual 2    %
                                                                          jan-09       jan-08       R3 - R2
    Product type              Sales office                                feb-09       feb-08     
    VINO                         ALIM. BALEARS                            789          1822         -56
    VINO                         ALIMENT. ANDALUCIA                       362          1000         -63
    VINO                         ALIMENT. BARCELONA                       745           830          -10
    (...extra rows suppressed...)
    If I remove Sales office on report design, report shows this information:
                                                                    Actual 3    Actual 2    %
                                                                    jan-09       jan-08        R3 - R2
    Product type                                             feb-09        feb-08     
    VINO                                                        90123       125316      -699
    So, percentage aggregation is doing a summation instead of an average.
    I can't change universe aggregation because we're using the same measure on the 3 columns (it's a calculation on BW).
    And the three columns are values belonging to the same dimension (they are dimension values), so how could I use a new measure only for the third column?+
    Any more workarounds?
    Thanks and best regards,
    David.
    Edited by: David Sirvent on May 28, 2009 1:53 PM

    David,
    My advise would be to not use the calculation for percentage defined within the BW query. The query in Webi is executed only once. If you remove an object from your report the BW query is not executed again, but Webi is just aggregating based on the setting of the object in the universe (in this case it summerizes the percentages).
    It would be better to define a variable with the calculation of the percentage in Webi itself. Then no matter what objects you put in the report the variable is recalculated at any level.
    Regards,
    Harry

  • BEx Query Providing Incorrect Results

    I have two BEx queries that are behaving strangely.
    They are providing incorrect results and I can't figure out why.
    In both cases, when I save query in development under a different technical name the problem disappear.   I can't use this as a permanent solution because users insert queries in workbooks and we have portal links.
    Is there a way to somehow  fix these queries that
    are acting strangely.
    Query 1:
    When run query get error message
    "No roll storage space of length 120 available fro OCCURS area"
    Query2:   Calculates Wrong Average
    When run query:
    Adding Cumulative Qty Customer Balance + Quantity Customer Movement
    together.
    Set Aggregation to Average
    ref char Posting Period.
    The avearge BEx calculates only considers  Cummulative Quantity
    End Customer Balance.  It should consider consider Quantity Customer Movement as well.
    Avg formula :  ((Jan End - (.5* Jan Mov) ) + (Feb End - (.5* Feb Mov))+   (Mar End -(.5* March Mov)))/3
    I have used the same  methodology to calculate average with other queries and it average calculates correctly.  These other queries have same InfoProvider and using the same dimensions as queries that are calculating average incorrectly.

    Hi Mti
    Thank you for your reply.
    I have checked the details as per your suggestion:
    1. KF Aggreagtion tab on Workbench Exception Aggregation is on SUM Summation.
    2. RKF on The Query is on (Nothing Defined).
    Is there anything else that can be checked?
    Thank you

Maybe you are looking for