Query key figures calculation issue

Dear Sap Gurus,
I would like to calculate the sum of one key figure on the month m-3 m-2 and m-1
I have created 3 restricted key figures filtered by month m-3, m-2 and m-1
i have created a key figures one which one I sum these 3 key figures but the result per month is not egal to the summation but to the value per month
on the example below
one this field is what i have D- Sum Other Requirements
one this field is what i would like to have Sum Other Requirement Past
Thanks for your answer
Calendar Year/Month     janv-07     FEB 2007     mars-07
D- Other Requirements month-6     69,888 PC          
D- Other Requirements month-5          281,385 PC     
D- Other Requirements month-4               19,854 PC
D- Sum Other Requirements     69,888 PC     281,385 PC     19,854 PC
Sum Other Requirement Past     69,888 PC     351,273 PC     371,127 PC

Hi,
Create one RKF based on your key figure,
go t property of RKF and mark constant selection.
now in this field you can see the sum of key figure field.
and you can use it for formula.
Hope it help you.
Regards
Suneet

Similar Messages

  • Key Figure Calculation in Query

    Gurus,
    How do i calcculate below  in query  basically i have 3 KF as dates below and want a CKF or formula variable
    which calculates A - (IF B Not Empty then take B  or else take C.)
    Z = A - if (B != " '', B, C)
    A = Key Figure
    B = Key Figure
    C = Key Figure
    thanks

    HI Zuben,
    To acheive this
    calculates A - (IF B Not Empty then take B or else take C.)
    Z = A - if (B != " '', B, C)
    A = Key Figure
    B = Key Figure
    C = Key Figure
    Try this !!!!!!!
    If u create a  CKF,u will have operators in it,in that choose Boolean Operators,again in that chose
    1)is not equal to
    and
    2)Equal to.
    for ur calculations.
    Z= Calculated Key Figure.
    Z= A - (B NE 0)B + ( B EQ 0)C
    Case One -- B NE 0
    Z= A-(1 * B)+0
    Z = A-B
    Case Two -- B EQ 0
    Z= A-(0 * B)+(1*C)
    Z = A-C
    I guess this is your requirement.
    Rgds
    SVU

  • BEx Query key figure sum different at monthly or at docu number level

    I have a query designed in Query Designer. The report is summarized at the monthly level , but the document number is available for drilling down. What's strange is that the sum of the key figures is different when running at the monthly level or when drilling down at the document number level. Can someone share your insight on what how to solve this problem?
    Thanks,
    Sharon

    Hi Sharon
    Which key figures give you an incorrect picture or discrpancies in the two displays ?
    Check the properties of these key figures. Are any of the key figures posing an issue calculated as 'Formula'. If yes, then what is the Calculate Result as for this KEy Figure ? Is it TOTAL ?
    Cheers
    Umesh

  • Key Figure Calculation in Transformation

    Hi Experts,
    I have what seems like a relatively simple question however I cannot figure out the solution at the moment.  I was hoping someone shed some light on the situation.
    I am loading line item detailed information into a DSO with various key figures.  I am loading quota type information into the DSO and need to sum the amount key figure if a specific quota type exists.  For instance:
    Quota Type: 16
    Amount: 15
    Quota Type: 14
    Amount: 5
    If an employee has a Quota Type 14 then the Amount value of Quota Type 16 should equal 20 given the values above. 
    What is the easiest way to write this formula/routine?  I was thinking this had to be done in a routine. 
    Thanks,
    DC

    Hi,
    If I have understood your requirement correctly ......
    What we can do in such a scenario is ......
    1. Make two restricted key fig. in Query designer ..... One for   amount(16) and the other for amount(14)........
    2. Set display mode as 'HIDE' for both of them.... so that we cannot see them in the query output....
    3. Now, make a calculated key fig. and add these two restricted key figs.
    4. This new calculated key fig. will give us the desired result subject to the condition that other characteristics are same .....
    I dont think we need to write any code here ......
    Hope it helps ....
    Please award points if it helps .....
    Regards
    Anshul

  • Key Figure calculation in Abap is not working correctly - Overlooping

    Hi,
    I wrote a logic to calculate the ratio of key figure but it is not working correctly
    For example I have a requirement to split 1 Product into Several new Products and also the Net Amount will be splitted to these several new products as well. The total Amount of the new product will be equivalent to the Net Amount.
    So far my Logic is splitting the product to several new products but the amount is incorrect as the calculation is over looping.
    Sample
    A PRODUCT has Net Amount 1000. And this product needs to be splitted into 3 new products. Each of this new product is assigned a ratio of 0.3, 0.2 and 0.7 respectively. total sum of the ratio is 1.
    PRODUCT1 0.3 = 1000 * 0.3 = 300
    PRODUCT2 0.2 = 1000 * 0.2 = 200
    PRODUCT3 0.7 = 1000 * 0.7 = 700
    The total amount of this new products is 1000.
    Now my logic is working this way.
    PRODUCT1 0.3 = 1000 * 0.3 = 300
    PRODUCT2 0.2 = 1000 * 0.2 * 0.3 = 60
    PRODUCT3 0.7 = 1000 * 0.2 * 0.3 * 0.7 = 42
    Only the PRODUCT1 is working correctly and there is overlooping for the remaining products
    Logic used
    DATA: t_data TYPE data_package_structure OCCURS 0 WITH HEADER LINE.
    DATA: t_newdso LIKE /bic/newdso OCCURS 0 WITH HEADER LINE.
    DATA: t_olddso LIKE /bic/olddso OCCURS 0 WITH HEADER LINE.
    DATA: amount LIKE data_package-netamount.
    DATA: zidx LIKE sy-tabix.
    REFRESH t_data.
    LOOP AT data_package.
      zidx = sy-tabix.
      MOVE-CORRESPONDING data_package TO t_data.
      REFRESH t_newdso.
      SELECT * FROM newdso INTO TABLE t_newdso WHERE prod =
      data_package-prod.
      SORT t_newdso BY prod.
    *LOOP AT T_NEWDSO.
      READ TABLE t_newdso WITH KEY prodh4 = t_data-prod.
      IF sy-subrc EQ 0.
        LOOP AT t_newdso.
          t_data-prod = t_newdso-/bic/znew_mp.
          t_data-material = t_newdso-material.
    *T_DATA-NETAMOUNT = T_DATA NETAMOUNT * T_NEWDSO-/BIC/ZSP_RATIO.*
          APPEND t_data.
        ENDLOOP.
      ELSE.
        REFRESH t_olddso.
        SELECT * FROM olddso INTO TABLE t_olddso WHERE prod =
        data_package-prod.
        SORT t_olddso BY prod.
        READ TABLE t_olddso WITH KEY prodh4 = t_data-prod.
        t_data-prod = t_olddso-prod.
        t_data-material = t_olddso-material.
        APPEND t_data.
      ENDIF.
      MODIFY data_package INDEX zidx.
    ENDLOOP.
    REFRESH data_package.
    data_package[] = t_data[].
    thanks
    Edited by: Matt on Sep 27, 2010 2:25 PM - added  tags

    Hi,
    I am not really good at debugging Abap code since I am a newbie. however  I have tried to add CLEAR T_DATA before the first loop.
    REFRESH T_DATA.
    LOOP AT DATA_PACKAGE.
    ZIDX = SY-TABIX.
    MOVE-CORRESPONDING DATA_PACKAGE TO T_DATA.
    and before the second loop and select statement and at the end of the loop.
    REFRESH T_NEWDSO.
    SELECT * FROM NEWDSO INTO table T_NEWDSO WHERE PROD =
    DATA_PACKAGE-PROD.
    SORT T_NEWDSO BY PROD.
    READ TABLE T_NEWDSO WITH KEY PROD = T_DATA-PROD.
    IF sy-subrc EQ 0.
    LOOP AT T_NEWDSO.
    but then not all data are being fetched.
    thanks
    Edited by: Bhat Vaidya on Sep 28, 2010 8:33 AM

  • In Query key figure are not populated

    Hi Gurus,
    i am using a RSCRMBAPI to get the out put of my query into a Ztable but when i run my program the Ztable is getting data but no key figures are getting populated.
    plz help
    thanks
    neelu

    Hi gurus,
    i just have 1.6lac records with six keyfigures so i think its not the problem of limitation...
    then can somebody help me how to get rid of this, no key figure values are getting populated
    thanks and regards
    Neel

  • Use of Key Date in Virtual Key Figure Calculation

    I have a virtual key figure whose value depends in part on the key date entered by the user.  I have the VKF set up with a dummy calculation, and it is working OK.
    How do I refer to the value of the key date in the code that assigns the VKF value?
    Thanks,
    DP

    Found the answer, thanks to another thread:
    Function RRS_VAR_VALUE_FROM_MEMORY_GET with I_VNAM equal to the key date variable returns the value of the key date.
    DP

  • Query key figures showing incorrect values

    Hi,
    key figures in my query are showing incorrect values NO CALC POSSIBLE
    Data in the cube is coming from different datasources and the cube is compressed.
    this is how data in the cube looks like
    plant    Unit   currency    Stock Quantity    Stock Value   total ( *** key figure ( inflow and outflow)
    P001    ST                         1000                   0 
    P001             EUR                                    100
    Query result
    plant       stock(PC)            Stock Quantity   Stock Value       total ( cumy figure ( inflow and outflow)
    P001       No Cal possible    1000                  100                   No Cal possible
    How do I resolve in query or cube level so that the NO CALC possible is not displayed.
    thanks

    Hi,
    Indeed my cube is a copy of 0IC_C03.
    Could you please explain more about the filtering.
    I have the following key figures
    0TOTALSTCK
    0ISSTOTSTCK
    0RECTOTSTCK
    ZISSSTCK_VALUE
    ZREC_VALUE
    ZTOTSTKVALUE
    ZTOTSTKVALUE is CKF with inflow and outflow of ZISSSTCK_VALUE
    ZREC_VALUE
    Whenever there is 0 it displays NO CALC possible. I would like to have it blank or 0s.
    thanks

  • Need Method to Look Up Prices from a 8 X 7 Grid for BW Query Key Figures

    Hello.
    I have Material Groups that have various costs associated with them in the format of an 8 X 7 Excel Grid.
    Rows:
    Shipping
    Packaging
    Labor
    Etc.
    Columns:
    Cost if sales were above 10,000 per month.
    Cost if sales were above 15,000 per month.
    Cost if sales were above 20,000 per month.
    etc.
    I need to figure out a way to have a BW Query lookup the price from the row and column based on the monthly volumes.  (kind of like a VLOOKUP and an HLOOKUP in Excel).
    I thought about simply creating Key Figures for every possible combination, but I would've ended up with 56+ key figures on my ODS object.
    Does anybody have a suggestion for me to do this in a cleaner manner?
    Thanks.

    Hi kenneth,
    If i've understood ur prob correctly than you can use the conditions function in the query...create separate conditions for your criteria and display the output ....
    Ajay

  • Combine two reports in query designer using key figure with sap exit

    Hi experts,
    i want to combine two reports in query designer using key figure with sap exit
    in the report 1 key figure calculation based on the open on key date(0P_DATE_OPEN)
    to calculate due and not due in two columns
    in report 2 key figure calculate in the time zones using given in variable Grid Width (0DPM_BV0) like due in 1 to 30 days, 31 to 60 days...the due amount based on the open on key date(0P_DATE_OPEN)
    to calculate in 1-30, 31-60, 61-90, 91-120, 121-150 and >150 days in 6 columns
    now i have requirement like this
    not due, 1-30, 31-60, >60, due,1-30, 31-60, >60 in 8 columns
    or
    not due, due, 1-30, 31-60, 61-90, 91-120, 121-150 and >150 in 8 col
    thank you

    Hi Dirk,
    you perhaps know my requirement,
    for the management to make used in one report,
    we have in reporting finacials Ehp3.
    Vendor Due Date Analysis - which show due, not due
    Vendor Overdue Analysis - show only due and analysis in time grid frame
    i want to combine in one report that show NOT DUE, DUE, DUE time frames in grid.
    krish...

  • Calculated key figures Vs local formula

    HI,
    I am having 4 queries on a cube.
    i am now using calculated key figures instead of local formulae.
    I want to know "which is better in performance wise/ or may be pros and cons of using each one."
    Can any one clarify me.
    I know that
    1.when we select the option Calculation after aggregation will improve performance.
    2.we can do some more things only with Cal. Key Figs using formula variable.
    Here my concern is not that.
    I am concerned about general case like -
    i have to add, multiply or divide some direct key figures and use some data functions like nodim, NDIV0 functions.
    Thanks in advance.
    Regards,
    Raghu

    Hi Raghu,
    Formulas cannot be directly reused, but if they are saved to a global structure, then the structure may be reused. If you are creating a calculation that will be widely used, it is best to create it as global...this helps a lot when you need to revisit the definition, and make changes as one chnage is reflected in all queries.
    However, there are some functions like SUMCT, SUMGT, SUMRT, %CT, %GT, %RT which are available only to the formulas (local), so if you need to use them, you cannot use a CKF.
    In addition to the differences, A formula can only work on other formulas/selections already in your query (in the same structure as your new formula), while a calculated key figure can only work on other key figures, calculated key figures or restricted key figures. However both can use formula variables.
    CKF are calculated at the time of loading data.
    Your Formula calculates at the time of running the query.
    Hope this helps...
    Regards,
    Yokesh.

  • Diff between Calculated key figure and new formula 6extra functions why

    Hi Friends
                  In BEx query designer we have Restricted key figure & Calculated key figure. In the case of Ristricted Key figure And new selection the difference is Global and local.
    But if we come to Calculated Key figure and New Formula the difference is same global and local. But in New formula we have 6 extra function. My question is does is there any certain reason for this or SAP AG not be able to develop those functions
    Thganks & Regards
    Bramhanand

    Hi Surendra thank you for your reply.
    But i am not asking difference between calculated key figure and New formula.
    What i am asking is in the case of Restricted Key figure And new selection the difference is Global and local.
    But in Calculated Key figure and New Formula the difference is same global and local and in New formula we have 6 extra function. My question is does is there any certain reason for this.Why not SAP AG is not included the new formula functions in Calculated key figure.
    Thanks & Regards
    Bramhanand

  • Calculate key figures totals in report based in multiprovider doesn't work.

    Hi dear Friends:
    We have a requirement where the data are in 2 different cubes, the layout defined is
    selections parameters :
    Zsales_offices
    0calweek
                   Columns.
                   0calweek  KFCalc1..............................KFcalc2.....................etc.
                   In rows.
                   01.2007   Qty on demand X unit cost.    sum of all qty's prods
                   02.2007
                   03.2007
                   04.2007
    the structure in cube z1mis contain:
    Zsales_offices,product,0calweeek,unit cost.
    the Second cube structure zdemand contain:
    Zsales_office, product,0calweek,qty on demand
    Our problem is:
    1. As you can see we need keep into KFcalc1 the product from multiply Qty on demand * unit cost but when the result is displaying the result is a wrong amount and the reason is because didn't´t exist a characteristic product in the layout, without this characteristic the amount for qty on demand and unit cost are summarized and multiplying with these amounts.
    We are trying to find a solution vía restricted key figures, calculating before aggregation, but it's not woks.
    I hope that you can give one suggestion.
    Regards.
    Eg@n

    Hi,
    putting product in the rows will slove the issues as the unit cost  depends upon the  prdoduct and therefore it will uniquely identify each of the material and then it will get multiplies with the qty and therefore you will get the correct result.
    this kind of issue you will always face when you are going to multiply cost with the Qty and as the cost differ with the individual material.
    Also putting material into the rows will cause the no. of rows to increase as all the materials will show up in the individual rows for the particular month.
    Also you can make a claculated key fgure for the multiplication and use before aggregation.
    But for that your both the key figures should be in the same cube i.e. in the same rows or the before aggregation will not work you will not even get an option of before aggregation in the CKF if the key figures belong to two different cubes.
    Since your qty and cost are coming from two different cubes before aggreagtion will not work here.
    And if you do before aggregation then you report will become quite slow as it will do all the multiplication anf then will bring the result.
    So it depends on your requirement and your design how to proceed.
    Hope it helps
    Thanks

  • Restricted key figure

    HI,
    can any body explain me what is the difference between Restricted key Figure and the filter option in BEX reporting.

    Hi Ali,
    If you want restrict particuler key figure based on characteristic value, that you have to go for restricted key figure.
    For example: You have calender year month data from 2005 to 2006.An dyou have also have sales data for the period.
    If you want see the say some feb 2005 to may 2006.
    than you can use restricted key figure to see the values.
    where as Filter will show the values which you have filtered irrespective of key figure (only characteristic value).
    just go throw the below description.
    Hi,
    Restricted key figure:
    Use
    You can restrict the key figures of an InfoProvider for reuse by selecting one or more characteristics. The key figures that are restricted by one or more characteristic selections can be basic key figures, calculated key figures, or key figures that are already restricted.
    Procedure
    Defining a new restricted key figure
    1. In the InfoProvider screen area, select the Key Figures entry and choose New Restricted Key Figure from the context menu (secondary mouse button).
    If a restricted key figure has already been defined for this InfoProvider, you can also select the Restricted Key Figures entry and then choose New Restricted Key Figure from the context menu.
    The entry New Restricted Key Figure is inserted and the properties for the restricted key figure are displayed in the Properties screen area.
    2. Select the New Restricted Key Figure entry and choose Edit from the context menu (secondary mouse button.
    The Change Restricted Key Figure dialog box appears.
    You can also call the Change Restricted Key Figure dialog box from the Properties screen area by choosing the Edit pushbutton.
    Calculated key figure:
    Use
    In the Query Designer, you use formulas to recalculate the key figures in an InfoProvider so that you can reuse them. Calculated key figures consist of formula definitions containing basic key figures, restricted key figures or precalculated key figures.
    Procedure
    Defining a New Calculated Key Figure
    1. In the InfoProvider screen area, select the Key Figures entry and from the context menu (secondary mouse button click), choose New Calculated Key Figure.
    If a calculated key figure has already been defined for this InfoProvider, you can select the Calculated Key Figures entry and, from the context menu, choose New Calculated Key Figure.
    The system adds the New Calculated Key Figure entry. The properties for the calculated key figure are displayed in the Properties screen area.
    2. Select the New Calculated Key Figure entry and, from the context menu (secondary mouse button), choose Edit.
    The Calculated Key Figure dialog box appears.
    You can also call the Change Calculated Key Figure dialog box from the Properties screen area by choosing the Edit pushbutton.
    Formula:
    Use
    You can recalculate the key figures in a structure using a formula. You can include basic key figures, restricted key figures, and calculated key figures in the formula definition.
    Procedure
    Defining a Formula
    1. If the query does not yet have a key figure structure, create a New Structure in the Rows or Columns of the Query Designer by highlighting the row or column directory using the secondary mouse button and selecting New Structure from the context menu.
    2. If the structure does not yet contain any key figures, use drag and drop to transfer a (basic) key figure of the InfoProvider into the directory of the new structure.
    3. Select the structure directory, and choose New Formula. The New Formula entry is inserted and the properties for the formula are displayed in the Properties screen area.
    4. Select the New Formula entry and, from the context menu (secondary mouse button), choose Edit. The Change Formula dialog box appears.
    You can also call the Change Formula dialog box from the Properties screen area by choosing the Edit pushbutton.
    Regards,
    Shailaja

  • BEx Broadcaster Send button - No Broadcast Wizard with Key Figures in Rows

    Working in BI 7.0 SP 16, we are having an issue with BEx Broadcaster.  For a typical horizontal query (key figures in columns), the send button in BEx on the Portal works properly and returns the Broadcasting Wizard.  However, when using a query in a vertical format (key figures in rows), the window opended by the send button displays the "spinning wheel" and never procceds on to the Broadcasting Wizard.
    I have checked for SAP notes related to BEx Broadcaster and was not able to find anything relevant.
    The same query was tested with the key figures in columns and in rows.  The Broadcast Wizard comes up when the key figures are in columns, but not in rows.  Since it was tested both ways with the same query, I am assuming that the issue is related to the orientation (horizontal vs. vertical).
    Has anyone else run into this issue?  Is there a known limitation, or a patch available?  Does anyone have a BI system with a query you could flip the key figures from columns to rows and give it a try?
    thanks,
    -Shawn

    Shawn,
    I'm having my own issues with BEx Broadcaster in the Portal, but from BEx Query Designer - Query - Publish - BEx Broadcaster, the BEx Broadcaster Wizard is available in both cases (Key figures in columns and key figures in rows).
    Kim

Maybe you are looking for