Sum up key figures in cube

Hi,
I would like to include an ABAP code in a start routine.
My infocube contains account numbers.  for each account there is an amount (0QUANTITY) and a 0CALMONTH.  Each line in the cube contains an account number and a 0CALMONTH.
On every line of my infocube (for every account number with its 0CALMONTH) I would like to calculate in a new column the total amount for a duration of a roll back year.  Ex: Account Number 123, 0CALMONTH = 01/2009, 0QUANTITY = 10 -> In the new colomn I want the sum of 0QUANTITY for a roll back year (0QUANTITY 01/2009 + 0QUANTITY 12/2008 + 0QUANTITY 11/2008 + ... + 0QUANTITY 02/2008).
Can someone give me an example of the ABAP code to perform this?
Thanks a lot!

When applying the solution you describe, beware of the modification on the different axis you use in your query.
For instance, if the characteristic owner is linked to the characteristic Account, and if it can changed, you can encounter some difficulties to consolidate your data:
On January :
  Account N° 123 Owner 001 -> 0CALMONTH 01/2009 -> Quantity 10
  Account N° 123 Owner 001-> 0CALMONTH 02/2009 -> Quantity 10
On February :
  Account N° 123 Owner 002 -> 0CALMONTH 02/2009 -> Quantity 20
  Account N° 123 Owner 002-> 0CALMONTH 03/2009 -> Quantity 20
Here, data on february are assigned to the owner 1 and 2 (for the same account), this is not what you necessarily want...
The problem is that you assign values in the future (and here, you don't know which owner will be assigned to the account in this future)...
Regards,
Fred
Edited by: FCI on Jun 18, 2009 4:22 PM

Similar Messages

  • Summing up key figure in Cube - data load from ODS

    Hello Gurus,
    I am doing a data load from ODS to cube.
    The records in ODS are at line-item level, and all needs to be summed up at header level. There is only one key-figure. ODS has header and line-item fields.
    I am loading only header field data ( and not the item-field data) from ODS to Cube.
    I am expecting only-one record in cube ( for all the item-level records) with all the key-figures summed up. But couldn't see that.
    Can anyone please explain how to achieve it.
    I promise to reward points.
    =====
    Example to elaborate my point.
    In ODS
    Header-field  item-field   quantity
    123                301          10
    123                302           20
    123                303           30
    Expected record in Cube
    Header-field       Quantity
       123                    60  
    ====================
    Regards,
    Pramod.

    Hello Oscar and Paolo.
    Thanks for the reply. I am using BW 7.0
    Paolo suggested:
    >>If you don't add item number to cube and put quantity as adition in update rules >>from ODS to cube it works.
    I did that still I get 3 records in cube.
    Oscar Suggested:
    >>What kind of aggregate do you have for your key figure in update rules (update >>or no change)?
    It is "summation". And it cannot be changed. (Or at least I do not know how to change it.)
    There are other dimensions in the cube - which corresponds to the field(s) in ODS.
    But, I just mentioned these two (i.e. header and item-level) for simplicity.
    Can you please help?
    Thank you.
    Pramod.

  • How to filter rows according to calculated key figures in cube?

    in my cube , i use V3 update for scheduleding lines of sales items.For example , in last delta update , valid row is last column ,other two rows make zero each other for key figures but i dont want to display first two rows in Bex.i want to get rid of these rows.because of not deleting previous data in cube, how to discard the rows , can i filter by calcuated key figures in query analyzer (like not display if sum of key figures zero)   
    Doc_No       Doc_Type   Reject_St          Item_No     Net_Price(Key_Fig)     Total_Pric(K_F)
    0002207615    TA           99               10        17,000             295.630,00
    0002207615    TA           99               10        17,000-            295.630,00-
    0002207615    TA           04               10        17,000             295.630,00

    if you do compression with <b>Zero Elimination</b> your problem will be sloved.
    or
    In the calculated Keyfigure, set to After Aggregation.
    Nagesh Ganisetti.

  • How to Selectively Delete ONE Key Figure from Cube....

    Hi:
    On a Daily basis (Via Process Chain), I need to do the following:
    1.  DELETE Single Key Figure from my planning cube.  When the "PYMNT DATE" is greater than System Date, then delete the
         key Figure.
    2.  Once Deleted, LOAD the same Single Key Figure from another cube when the PYMNT DATE is GT  System Date. 
    How can I do this in a Program.  What would be the code for this?  Need help with ABAP.
    Thanks in advance.....  PBSW

    Hi,
    See Article on Selective Deltaion in
    http://wiki.sdn.sap.com/wiki/display/profile/Surendra+Reddy
    Using Selective Deletion in Process Chains
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/business-intelligence/s-u/using%20selective%20deletion%20in%20process%20chains.pdf
    Thanks
    Reddy

  • Key Figure in cube loaded zeros, Strange problem

    Cube with three key figures
    1)counter(for each record, CONSTANT 1)
    2)Count with Exception aggregation (CONSTANT 1)
    3)NO OF DAYS
    NO OF DAYS is calculating and displaying correctly, where as   other two key figures in the cubes are zero (backend cube data as well as query).
    Working fine in DEVELOPMENT AND NOT IN TEST.

    Hi TR,
    Pls do activate the update rules in test. Also check the  update rules display. I hope the reason for this problem is the 'update type' set to 'no update' for the keyfigure.
    Hope this helps...Let me know
    Regards,
    R.Ravi

  • Storing Cummulated key figures in cube

    Hi,
    Can someone share on how to store cumulative key figure ? We have an Inbound and Staging layer that stores the inventory movements quantity. The staging layer contains material document and material item. At the reporting layer we need to be able to use the movement quantity and cummulate them by posting period. can someone share your thoughts on how this is coded with some performance considerations and delta. Is there an easy way to implement this in 3.X ?
    I.e.
    Material | Plant | Calendar Day | Quantity | Cummulated
    A | XYZ | 01.01.2011 | 10 | 10
    A | XYZ | 12.01.2011| 5 | 15
    B | XYZ | 12.01.2011| 40 | 40
    A | BBB | 13.01.2011 | 6 | 6

    if youre staging is a dso then you are in luck. you could create a transformaiton routine to read the active dso table, find the key and read all the quantity on it and then store the quanity in the new infoobject result..
    it should wok with delta.. unless somebody else comes up with a better idea..
    or you could do it in CMOD before you bring it in BW system, makes it run even faster..
    if your main object is a structure i could send u some code that help you figure it out..

  • Calculations for Key Figure at CUBE Level or REPORTING Level

    Hi Folks,
    What are the conditions to decide whether we need to go for keyfigure calculations at infocube level or at reporting level.
    How to achieve them if done at cube level.
    Could anyone provide some KT with examples?
    Regards
    Kittu

    Hi,
    I got your point.
    Could you tell me how to use below mentioned formula at transformation time?
    In brief the formula calculates the number of policies using field  " s endorsement type".
    Formula is as below:
    SUM(CASE WHEN S Endorsementtype IN ('004','015') THEN -1 WHEN S Endorsementtype IS NULL  AND S Gross IS NOT NULL  THEN 1 ELSE 0 END)
    No of policies is a calculated keyfigure.I dont have this field in my datasource.
    could you tell me the steps ?
    Regards
    kittu

  • Help Required for Mapping Key figures from Cube to APO Planning area.

    Hello Experts,
    We have created cube in APO BW and now we want to map it to Planning area how we can map.
    Can any body explain how we can map keyfigures?
    What is the use of livechache how it will be updated?
    Regards
    Ram

    Hi,
    I am not very sure about the 9ARE aggregate (haven't used it in backups), but RTSCUBE is used to copy time Series (TS) KF data from cube to planning area (SNP or DP).
    Are you trying to restore some time series data from your backup cube to the planning area? If yes, then do a mapping of characteristic from cube to planning area in RTSCUBE, and also map the TS KF between cube and planning area.
    If your KF is not a time series KF, then you can't copy it from cube to planning area. You could get data to cube for some reporting, otherwise I am not sure what use the backup is for you. For SNP, most of the data would be received from R/3, so there's not much point in having a backup.
    Hope this helps.
    Thanks - Pawan

  • Key figure routine in update rules

    I have a Cube (X) that gets data from a ODS (A) but one of the key figures gets the data from another ODS (B) with a routine in update rules and I want to change it to ODS (C)
    A (All objects except one) - X (All objects except one)
    B (0DEB_CRE_LC) - X (0DEB_CRE_LC)
    select sum( DEB_CRE_LC )
             into RESULT
             from /BIC/AZDOC_SUB00
             where OI_EBELN EQ COMM_STRUCTURE-OI_EBELN
              and OI_EBELP EQ COMM_STRUCTURE-OI_EBELP
              and /BIC/ZCLASC_ID EQ COMM_STRUCTURE-/BIC/ZCLASC_ID
              and PSTNG_DATE LE l_datafim
              and PSTNG_DATE GE l_datainicio
              and /BIC/ZTPOPER = '9'.
    My problem is that my ODS (C) doesn't have 0DEB_CRE_LC and the values are divided in 2 key figures (D) & (E), I want to sum both key figures into 0DEB_CRE_LC of the cube.
    I tried a tip from a friend but didn't work, I'm lost (newbie), and apreciated some tips, it doesn't seem to sum anything
    data: result1 type /BIC/AZPUR_S0100-/BIC/ZSLIQ_VAL,
          result2 type /BIC/AZPUR_S0100-/BIC/ZSIVA_VAL.
    select sum( /BIC/ZSLIQ_VAL ) sum( /BIC/ZSIVA_VAL )
             into (RESULT1, RESULT2)
              from /BIC/AZPUR_S0100
               where OI_EBELN EQ COMM_STRUCTURE-OI_EBELN
                and OI_EBELP EQ COMM_STRUCTURE-OI_EBELP
                and /BIC/ZCLASC_ID EQ COMM_STRUCTURE-/BIC/ZCLASC_ID
                and PSTNG_DATE LE l_datafim
                and PSTNG_DATE GE l_datainicio.
      write result1.
      write result2.
    Many thankx

    data: result1 type /BIC/AZPUR_S0100-/BIC/ZSLIQ_VAL,
    result2 type /BIC/AZPUR_S0100-/BIC/ZSIVA_VAL.
    select sum( /BIC/ZSLIQ_VAL ) sum( /BIC/ZSIVA_VAL )
    into (RESULT1, RESULT2)
    from /BIC/AZPUR_S0100
    where OI_EBELN EQ COMM_STRUCTURE-OI_EBELN
    and OI_EBELP EQ COMM_STRUCTURE-OI_EBELP
    and /BIC/ZCLASC_ID EQ COMM_STRUCTURE-/BIC/ZCLASC_ID
    and PSTNG_DATE LE l_datafim
    and PSTNG_DATE GE l_datainicio.
    write result1.
    write result2.
    <u>RESULT = result1 + result2</u>
    I still have to test it, first i was getting syntax errors because I didn't put spaces right sorry

  • Multicube with Cumulative and Non Cumulative Key Figures

    Is there any problems if I build a Multicube which consists of InfoProviders which have non-cumulative key figures (Inventory cube) and those which do not
    In the query I will be summing the key figure for example Stock Quantity across the InfoProviders? Thanks

    Hi,
    There is no problem if you do that only thing is when you assign key figures in the multiprovidesr you have to be careful in deciding the infoprovider from which the key figure comes.
    Hope this helps
    Assign points if useful
    Regards,
    venkat

  • How To Add New Key Figure in Manual Planning

    Dear All
    Please Help
    I Already implement BPS for 2 year.
    Now user want to add new key figure in Cube.
    I already add new key figure to cube and activated it.
    But in Manual Planning, The new key figure not show in selection
    what I must do?
    Please Help.
    Thanks

    Hi,
    not all key figure types are supported in BPS.
    1. All key figure types must have aggregation SUM, SUM.
    2. Supported key figure types:
    - amout
    - quantity
    - number (integer, float, dec)
    - time, only type DEC
    - datum, only type DEC
    All other key figures are filtered out and are not available in BPS.
    Regards,
    Gregor

  • 0IC_C03 - some key figures have unassigned Store location

    Hi,
    I try to implement Inventory managment scenario in BW.I follow the How to document How to handle inventory management scenarios in Bw.
    Now I uploaded data to BW, the sume of key figures as general look good but I have problem with key figures,which work with value in currency, this key figures(e.g 0ISSVS_VAL, 0VALSTCKVAL) are not assigned to Store location 0STOR_LOC, values of these key figures have this characteristics Unassigned (#), unlike key figures with amount value e.g. kg etc are assigned to store location. So there is problem that is no possibility to compare material stock in currency and amount.
    Do you have any experience how to solve this issue?
    I work with BI 7.0 version and use standard object from BI content without modification.
    Thanks
    Petr
    Edited by: Petr Jedlicka on Aug 12, 2011 2:30 PM
    Edited by: Petr Jedlicka on Aug 12, 2011 2:31 PM

    Hi,
    Inventory values are captured at site/plant levels not the storage locations. These values are caputured using 2lis_03_um datasource. When you create a material, materials are created as per site. 0MAT_PLANT.
    when there are movements of sales in the inventory, sales take place thru site not storage location. So sloc will not get updated in the transaction. where as when you move stock from one site to other site, there may be on storage location for all site or one sloc for one site. So for qtys you will have sloc.
    Thanks
    srikanth

  • Calculated key-figures are wrong in result rows

    Hi,
    I developed a BEx query which shows profi-centers and materials in the rows, and the price, the amount and the amount-value in the columns.
    Price and amount are basic key-figures on the cube, the value is calculated via a calculated key-figure in the query (price*amount).
    Now I have added result rows an profit-center level in the workbook. Everything works fine, BUT when I hide the materials, the result-row on profit-center level is calculated wrong.
    Is there any possibility to hide the material-lines without having the resul-rowts calculated wrong? Is there any feature like "caculate material in background but hide in the workbook"?
    I don´t like to create other basic key-figures on cube level, as this is only an example for lots of calculated key-figures which I use.
    Thanks for your help,
    Patrick

    Hi Patrick,
    Since the prices and amounts are on the material level, therefore the calculation for amount value will be correctly done only when you have materials in the rows.
    Now when you hide the materials, then the system would not know on what basis to do the calculation: I'll explain with an example.
    Let's take four materials which have the same profit center assignment. But the prices for each of them are different and so are the amounts. Now if you remove the materials from the rows, then say the system calculates amount-value by taking the average price and multiply that with the total amount of the four materials. That would also give an incorrect result - isn't it?
    So there is no way to define what the system should do when material is removed from the rows.
    So material would be the minimum required granularity for such a report to show correct results.
    Regards,
    Shweta

  • Misalignment of key figures in export to excel

    Hello Experts,
    I have a WAD report with 2 queries (say) Query A and Query B, in this report we are using table interface class for computing the sum of key figures in Query A with Query B and showing in the result row of QueryB
    When this report is executed it gives the correct output, but when i export this report to excel, the output of Query B gets mis-aligned.
    Please suggest what may be the reason behind this and how should i correct this problem.
    We are using MS office Excel 2003.
    FYI, for excel export, we're not using the standard feature, rather, using a class : CL_RSR_XLS_HELP_WINDOW_PRINT\
    Regards\
    Priyanka

    OK....!!!!!
    just download the Excel file (*.xls) and try open with Word-MS. In the document search by the string that you have mentioned in the question. (Use Ctrl +F).
    If you see something like "ABC bla bla ba & instead of  &amp ,  then you have to pass the data through the code I've mentioned.
    You can get more details on encoding special characters UTF-8 in Google.com or Sun Websites etc.
    You can also encode the & in hexadecimal format to get the desired output.

  • BO( WEBI,QAAWS ) can't sustain bw query : create new calculate Key Figure ?

    BO( WEBI,QAAWS ) can't sustain bw query : create new calculate Key Figure ?
    I create three new calculate  Key Figure : TotalQty1,Rate1,TotalRate1  on bw query. Return values:
    TSAS defect1     Qty     TotalQty1     Rate1     TotalRate1
    weight inaccuracy     33.000     33.000     37.500 %     37.500 %
    poor function     10.000     43.000     11.364 %     48.864 %
    gap out of spec     9.000     52.000     10.227 %     59.091 %
    scratch  /crack/ dam     8.000     60.000     9.091 %     68.182 %
    broken glass/mat     5.000     65.000     5.682 %     73.864 %
    missing display     6.000     71.000     6.818 %     80.682 %
    assembly defect     4.000     75.000     4.545 %     85.227 %
    plastic deformed     4.000     79.000     4.545 %     89.773 %
    no function     4.000     83.000     4.545 %     94.318 %
    poor  printing     5.000     88.000     5.682 %     100.000 %
    But Create on universe  connect  to this bw query, I used QAAWS and WEBI to runat , TotalQty1,Rate1,TotalRate1   key figure values are Qty value, that is error:
    TSAS defect1     Qty     TotalQty1     Rate1     TotalRate1
    weight inaccuracy     33     33     33     33
    poor function     10     10     10     10
    gap out of spec     9     9     9     9
    scratch  /crack/ dam     8     8     8     8
    broken glass/mat     5     5     5     5
    missing display     6     6     6     6
    assembly defect     4     4     4     4
    plastic deformed     4     4     4     4
    no function     4     4     4     4
    poor  printing     5     5     5     5
    pho:
    BW QUERY: [http://space.itpub.net/attachments/2010/04/10339719_201004211645561.thumb.jpg|http://space.itpub.net/attachments/2010/04/10339719_201004211645561.thumb.jpg]
    WEBI:[http://space.itpub.net/attachments/2010/04/10339719_201004211637351.thumb.jpg|http://space.itpub.net/attachments/2010/04/10339719_201004211637351.thumb.jpg]
    QAAWS:[http://space.itpub.net/attachments/2010/04/10339719_201004211637591.thumb.jpg|http://space.itpub.net/attachments/2010/04/10339719_201004211637591.thumb.jpg]
    Why? BO can't sustain bw query : create new calculate Key Figure ?
    Who to figure out this question?
    Because I can't to do create new calculate Key Figure   in webi or Xcelsius ,So ,I create new calulate Key Figure  on BW QUERY.
    Thank you.
    BestRegards,
    Howard.
    Edited by: flying on Apr 21, 2010 10:48 AM

    HI Ingo,
        Didier Mazoue  say universe accept bw query Restricted KF and calculated KF :
       [ Restricted and calculation keyfigures| Restricted and calculation keyfigures]
       Why I create new Restricted KF and calculated KF for bw query, QAAWS,WEBI are can't return ok datas for new Restricted KF and calculated KF ?
      I create KF on Universe :
        select ued : <EXPRESSION>@Select (Key Figures\Qty)</EXPRESSION>   OR <EXPRESSION>SUM(@Select (Key Figures\Qty))</EXPRESSION>  
    parse error: Parse failed:Invalid definition(UNV0023)
       Thank you.
    Regards,
    Howard.
    Edited by: flying on Apr 23, 2010 6:00 AM

Maybe you are looking for

  • Reg: passing wdEvent as a parameter .

    Hi All, I have a event handler method in my view. I am calling that method in some other method in the same view based on one condition by passing wdEvent as a parameter bcozz event handler methods have wdEvent as a parameter. for this I did com.sap.

  • Business Partner - Genric Search

    Hi We have recently upgraded our system from CRM 5.0 to CRM 7.0 We are facing some issue when comparing it with CRM 5.0 I have opened up complaints application, i do not see any generic option to search by Partner Function I can Search by Partner Fun

  • Satellite Pro M - F5 Function Key no longer working

    Hello all, I have had many happy years using my Toshiba laptop without problem. The operating system is Vista Home Plus. About a year ago, my son dropped the machine, which resulted in the display cracking. In order to keep using it I plugged in a sp

  • Creating output file on Mac PC's

    I am using XCode to run my Java application. My program runs well, but I would like to make an output file, preferrably to a desktop folder. Is there a way I can do this? Thanks

  • HT4859 retrieving photos from lost phone

    hi i have lost my iphone 4s. i think my icloud was on and i need to retrieve my photos on my laptop. is there anyway i can do it.