Cumulative value calculation in script logic

Hi,
  Assuming i have the following values:
Acc1, time1 = 2
Acc1, time2 = 10
Acc1, time3 = 20
Acc1, time4 = 30
  What script logic can i write such that the end results are:
Acc2, time1 = 2
Acc2, time2  = 12
Acc2, time3 = 22
Acc2, time4 = 32
  time1 could start from any month of the year, and the next month is always one month after the current month (i.e. if time1 = june, then time2 = july).
  Basically the above calculation involves some sort of cumulative effect. I would like to have this cumulative amounts stored in the database, hence i don't want to rely on measures="ytd" in the report.
Cheers

Hi Raja,
You can get the daywise cumulative value for the user selected date range by creating a formula on the KF & turning on the 'Cumulated' checkbox in the 'Calculations' tab.
--Priya

Similar Messages

  • Calculations in Script Logic

    Dear Experts,
    I am trying to do some calculations using script logic.
    Foe example: In account dimension I have three members A, B & C.
    Now i want to do A = B multiply C using script logic.
    I will insert data for B and C. The B, C should get multiply and insert in to A.

    hello experts,
    i am newbie to bpc & scriptlogic, i am, me too, trying to do some calculations using scriptlogic.
    i've created a dimension S_GOSTERGE with members SATISTUTARI, SAT_Fiyat, SAT_Miktar
    i want to calculate SATISTUTARI = SAT_Miktar * SAT_Fiyat
    so i've writed the script below.
    *XDIM_MEMBERSET S_GOSTERGE = SATISTUTARI
    *XDIM_MEMBERSET S_GOSTERGE = SAT_Fiyat
    *XDIM_MEMBERSET S_GOSTERGE = SAT_Miktar
    *WHEN S_GOSTERGE
    *IS SAT_Miktar
        *REC(FACTOR = GET(S_GOSTERGE ="SAT_Fiyat") , S_GOSTERGE = SATISTUTARI)
    *ENDWHEN
    *COMMIT
    when i click ''validate'' i get the error message : cannot find dimension ""SAT_FIYAT")"
    please, can you help me to solve this?
    thanks in advance.

  • How Acumulated Value in a script Logic

    Hello,
    We facing a problem here, that we cannot acumulated value using  script Logic.
    We need to calculated a account where we need the value to this account in the previous month
    Like That
                                JAN        FEB       MAR       APR        MAY
    ACCOUT
    A                          10           40          45         45            45
    B                           7            30          20         
    C                           3                        -15                  
    In this case we need to save the acumulated value to all months, until the end of the year, even if we dont input value in this months.
    Anyone facing this problem? 
    Best Regards

    You can't use a date display pattern on a text field, it has to be a date field.
    The only way around that is to use scripting to format the date and then put the date in a text field - I've done this using util.printd() (I think - going off the top of my head at the moment) and there's a way to do it with FormCalc too.
    Patterns work well once you get the hang of them. Display is how you want the data to look. Edit is the different ways you allow the data to be entered (multiple date, phone number patterns, etc.). Validate will validate that the Display pattern has succeeded. Data is the format to export.
    I haven't had a chance to look at your new file but if you use 2 date fields with patterns you would just need: dateField2.rawValue = dateField1.rawValue; with dateField2 having date.long{} as the display pattern. Come to think of it you could use Global binding and give the fields the same name and you wouldn't have to do any scripting.
    Radzmar has a good explanation of using multiple edit patterns for dates (English text is part way down): http://thelivecycle.blogspot.de/2011/10/date-patterns.html

  • Cumulative Value Calculation

    Dear Experts,
    I extracted data with the standard datasource 0CO_OM_OPA_1. Cost from this datasource is costs by month. However, I need to have another key figure for cumulative cost.
    1) How can I get cumulative values through the transformation? (I need to display data on Xcelsius, and I am not sure this cumulative value can be achieved in the report)
    2) I heard that we can calculate the cumulative value by Non Cumulative Key Figure. However, I don't know how it works. I try to create Non Cumulative Key Figure based on 0AMOUNT from the datasource, but it requires me to add 0CALDAY into my infocube. (The finest level in time dimension in my infocube is 0CALMONTH) Is it true that I can use Non Cumulative value to calculate cumulative value. If yes, how can I do that?

    Hi.
    Use a bex query to do the cumulative calculation of the monthly values. Hook that query up to a universe and retrieve it in Xcelsius.
    You can set the key figure property to "cumulative" in the query designer. That should get over to the BO Universe... if not, then you can cumulate it either straight in Xcelsius (you have to know the structure anyway, in order to build the graphs...) or use a web-i report.
    br
    Jacob

  • How to use total elements in a script logic?

    Hi All,
    I am using BPC 7.0 MS. I need to create a calculation using script logic as follows:
    The application name is GYP and it is composed by the following dimensions:
    PL (Account type) in this dimension are the units
    Time
    Category
    Entity
    Product
    RptCurrency
    I would like to make a calculation like this:
    UNITS of any product (base element) and any entity (base element) for the BUDGET category and LC currency divided by UNITS of TotalEntity.
    Also, I would like to check before the calculation if UNITS have any value to proceed with that calculation.
    Best Regards,
    Luisana

    Hi Robert,
    Thank you for your reply.
    Let me explain better what i would like to do. I have an application called GYP, it is composed for the following dimensions:
    PL (Account type)
    Time
    Category
    Entity
    Product
    RptCurrency
    In the PL dimension i have an element called UNITS and another one called UNITSBYX. I would like to get a calculation like this:
    For the BUDGET category and LC currency.
    UNITSBYX = UNITS for each ENTITY / UNITS for ALL_ENTITIES
    Let's say I have three entities:
    Units for Entity1 = 50
    Units for Entity2 = 100
    Units for Entity3 = 300
    Units for All_Entities = 450
    The calculation should be like this:
    UNITSBYX = Units for Entity1 / Units for All_Entities
    UNITSBYX = 50 / 450
    UNITSBYX = 0.11
    UNITSBYX = Units for Entity2 / Units for All_Entities
    UNITSBYX = 100 / 450
    UNITSBYX = 0.22
    I hope you get my point.
    Kind regards,
    Luisana

  • BPC 7.0 MS Script-Logic problem: New values used, old values written?

    I am trying to using BPC Script logic to update my Sales cube, specifically Revenue=Units*Price and Price=Revenue/Units using the "Price" stored in a seperate Price cube.
    Inside default.lgl, I am *INCLUDE-ing my own script:
    *LOOKUP PRICES
    *DIM PREIS:ACCOUNT="Price"
    *ENDLOOKUP
    *WHEN ACCOUNT
    *IS "Units"
    *REC(FACTOR=LOOKUP(PREIS),ACCOUNT="Revenue")
    *IS "Revenue"
    *REC(EXPRESSION=%VALUE%/LOOKUP(PREIS),ACCOUNT="Units")
    *ENDWHEN
    *COMMIT
    Now, when I insert new "Units" values using the std. Excel template, strange things happen:
    - The Revenues seems to be computed and updated correctly in the cube (if I check them using excel templates, they show up).
    - The Units seem to have the values they had before... seems they get old values ?!
    E.g. if I have several write operations say, I write units=2,3,4 and price is constant 10,
    the values in the cube seem to be (table):
    value written, units in cube, revenue
    3 , 2 , 30
    4,  3 , 40
    The new value is somewhere in the MS Analysis cube, otherwise, how could later be the new value be shown, although the excel templates seem to show old values?
    Any explanation for that strange behaviour?

    I simplified and wrote the prices in the same cube as I send the data from with the excel template.
    I tried using:
    *WHEN ACCOUNT
    *IS "Units"
    [Account].[#Revenue]=[Account].[Units]*[Account].[Price]
    *ENDWHEN
    *COMMIT
    *WHEN ACCOUNT
    *IS "Revenue"
    [Account].[#Units]=[Account].[Revenue]/[Account].[Price]
    *ENDWHEN
    *COMMIT
    Now, if units are send from the excel template, revenue is calculated correctly.
    If I enter revenue instead, seems that the 1st block is executed as well (why????!!!/how to avoid - I use *WHEN - what else should I do? )  which would explain the behaviour I get the old values for Units and Account again...
    Related: How can I use "*WRITE_TO_FILE"? I tried both
    *WRITE_TO_FILE Mylog.txt
    *WRITE_TO_FILE "Mylog.txt"
    But I can't find these file after sending data through the excel template... Do I have to create the files manually first or give full Path Names?
    Thanks!

  • Incorrect value with Script Logic

    Hello,
    From initial value called 2008.ORC we want to calculate for each month the percentage , from child DIASMES.
    Now, with the script logic ( I´ll put down later) we have an incorrect value in the column 2008.TOTAL.
    In other words, I´m sure I´m wrong with "WHAT" or "WHERE sentence or maybe the operation "FACTOR=USING/TOTAL" fails because the crossing between dimensions it´s incorrect.
    *RUNALLOCATION
    *FACTOR = USING/TOTAL
    *DIM FABRICA_MAQ WHAT=BAS(FABRICAFF); WHERE=BAS(FABRICAFF); USING=BAS(FABRICAFF);
    *DIM PRODUTOS WHAT=BAS(TOTALPROD); WHERE=BAS(TOTALPROD); USING=SP;
    *DIM TIME WHAT=2008.ORC;WHERE=BAS(2008.TOTAL); USING=BAS(2008.TOTAL);
    *DIM TIPO WHAT=BAS(TOT); WHERE=BAS(TOT); USING=ST;
    *DIM VARIAVEIS WHAT=MIXACABADA; WHERE=MIXACABADA; USING=DIASMES;
    *DIM DATASRC WHAT=INPUT; WHERE=INPUT; USING=INPUT;
    *DIM VERSAO WHAT=BUDGET; WHERE=BUDGET; USING=BUDGET;
    *ENDALLOCATION
    *COMMIT
    The Key is to see in the column 2008.TOTAL ( when we selected  "BAS") the value of parent divided into "DIASMES" !
    Thanks !! 

    Your factor statment references a TOTAL, but you don't reference the total in your DIM statements. If you look at the debug log carefully, you should notice that there's no calculation of a TOTAL value.
    Try something like this. The only reason I move some dimensions from the *RUNALLOCATION up to the *XDIM's is for legibility, since the allocation makes no shifts to these dimensions. The logic should produce the same results, either way.
    // These dimensions have no shift of data.
    *XDIM_MEMBER VERSAO=BUDGET
    *XDIM_MEMBER DATASRC=INPUT
    // I'm assuming here that FACRICAFF is the top member of this dimension.
    *XDIM_MEMBERSET FABRICA_MAQ = <ALL>
    *RUNALLOCATION
    *FACTOR = USING/TOTAL
    *DIM PRODUTOS WHAT=BAS(TOTALPROD); WHERE=BAS(TOTALPROD); USING=SP; TOTAL=<<<
    *DIM TIME WHAT=2008.ORC;WHERE=BAS(2008.TOTAL); USING=BAS(2008.TOTAL); TOTAL=<<<
    *DIM TIPO WHAT=BAS(TOT); WHERE=BAS(TOT); USING=ST; TOTAL=<<<
    *DIM VARIAVEIS WHAT=MIXACABADA; WHERE=MIXACABADA; USING=DIASMES;  TOTAL=<<<
    *ENDALLOCATION
    *COMMIT

  • Script Logic - Calculated Members

    Hello:
    Im trying to build a script member using calculated members:
    *WHEN CUENTA
    *IS U4000
    *ENDWHEN
    *COMMIT
    U4000 is a calculated member in the account dimension member. I tried using another account, that is not a calculated member and it works.
    How can use calculated member in this sintax?
    Thanks in advance.
    Luciana

    I would like to mention few things:
    1. OLAPLOOKUP it doesn't work anymore into 7.5. James can you double check. My tests is showing that OLAPLOOKUP is not even validate into 7.5
    2. Calc_Dummy_Org it is an option to get the values of calculate members
    3. It is strange that kind of condition because into script logic you are doing input for base members.
    So that condition to test when an account is a an account which is not base member for me doesn't seems to be right.
    I can understand if you are looking about the value of that account but not testing if an account it is an account which is not base member.
    So if you want to record something with value of your calculate member just use:
    *BEGIN
    ACCOUNT.#basememberforinput = ACCOUNT.Calculatemember
    *END
    *COMMIT
    Edited by: Sorin Radulescu on Nov 9, 2010 4:04 PM

  • Script Logic based on %value% of the Account

    Hi All
    Hope everyone is doing great. This blog has been really helpful.
    Version: BPC NW - 10, sp12
    I have a situation where I am using an account as FLAG01 and based upon the flag value input by the user, I would like the calculation to be executed.
    I have written the basic algorithm which I am looking forward to resolve:
    When FLAG01 = 0
         Do Nothing
    When FLAG01 = 1
           [ACCOUNT].[B] = [ACCOUNT].[A] * (-1)          and goes into ENTITY = "US_ELIM"
    When FLAG01 = 2
           [ACCOUNT].[B] = [ACCOUNT].[A] * (-1)          and goes into ENTITY = "NA_ELIM"
    I have written the script logic, but guess missing the syntax somewhere.
    eg:
    *WHEN "FLAG01"
    *REC(EXPRESSION = %VALUE% = 1 ? ((-1)*([ACCOUNT].[A]), 0 , ACCOUNT = "B", P_ENTITY = "US_ELIM")
    *REC(EXPRESSION = %VALUE% = 2 ? ((-1)*([ACCOUNT].[A]), 0 , ACCOUNT = "B", P_ENTITY = "NA_ELIM")
    *ENDWHEN
    Any insights are appreciated.
    Thanks
    AJ

    Worked like a charm, just had to make minor tweaks based upon details to test it and it worked.
    *WHEN ACCOUNT
    *IS EL05
    *REC(EXPRESSION = ([ACCOUNT].[EL05])==1? (-1)*([ACCOUNT].[FN-COS.1.4.1]):0, ACCOUNT = "FN-REV.1.1.3.5", P_ENTITY = "A")
    *REC(EXPRESSION = ([ACCOUNT].[EL05])==2? (-1)*([ACCOUNT].[FN-COS.1.4.1]):0, ACCOUNT = "FN-REV.1.1.3.5", P_ENTITY = "B")
    *ENDWHEN
    Really glad how the results came out in 3-4 hit and trials.
    Thanks Vadim, appreciate your help on this.
    Thanks to all who helped.
    Regards
    AJ

  • Fetching property value in script logic!!

    Hello Experts,
    We are using BPC 7.5 M, I am working on a script logic and need to fetch a value of a property of a dimension member where dimension member is itself defined in some property.
    We have a Org dimension which has a property "FORECAST_UNIT" and this property contains a member Id of Org dimension itself, In my script logic I need to fetch value of "Currency" property for the Org dimension member defined in "FORECAST_UNIT" property.
    Please Advice.
    Thanks & Regards,
    Rohit

    Hi Roberto,
    Attached code (In Image) is of our Aggregate Forecast Unit logic, Every Org (Entity) has an forecasting unit defined in Forecasting unit property in Org dimension and Forecasting unit is also a member of Org dimension, below logic aggregates the data at Forecasting unit level:
    The issue is that I need to check before the code marked in Red executes that if Org-- Forecasting unit -- Currency is USD then only Red part of logic should execute.
    Thanks & Regards,
    Rohit

  • [ASK] Get One Row of Property Value From Dimension in Script Logic

    Hello, i need help about how to get one row of property value from dimension in script logic.
    Let say there is CATEGORY dimension and the members are like this :
    ID                                                  YEAR   Status
    PLAN_2011                                   2011        A
    PLAN_2011_V1                            2011        I
    ACTUAL_2011                              2011        I
    FORECAST_2011                         2011        I
    FORECAST_2011_V1                  2011        A
    PLAN_2012                                  2012        A
    PLAN_2012_V1                           2012        I
    ACTUAL_2012                             2012        I
    FORECAST_2012                         2012        I
    FORECAST_2012_V1                  2012        A
    If i scope CATEGORY like this :
    *XDIM_MEMBERSET CATEGORY = [CATEGORY].PROPERTIES("YEAR") = "2011"
    Then i will get member scope like this :
    PLAN_2011                                   2011        A
    PLAN_2011_V1                            2011        I
    ACTUAL_2011                              2011        I
    FORECAST_2011                         2011        I
    FORECAST_2011_V1                  2011        A
    Question :
    In script logic, how can i read the second record of scope and move it to variable ?
    Ex. : I read second record, so i can get the data of second record (PLAN_2011_V1, 2011, A).
    Is there any function to read all record that had been scope ? So i can read all those 5 records.
    Is there any substring or offset function in script logic ? How to use it ?
    Thank you.

    Hi,
    Firstly, when we scope the logic, it doesnt fetch the entire record from the member sheet. It just fetches the ID.
    Secondly, we dont have the feasibility to read only the second ID and skip the others. However, one alternative is that you use the SELECT statement to store all the IDs in a variable, and then use a FOR loop. But this will loop through all the 5 IDs, as per your example. If you want to skip all the IDs except one, you should maintain some property, so that all the IDs are neglected which doesnt have a particular property value.
    Hope you got the idea.

  • Calculating sum in script logic

    Dear all.
    I am having a script which should be moving values from one parent account to another base account in default logic, but only if posted on certain other dimension, that is when not posted on a certain Brand in my brand dimension.
    Sounds pretty much simple..
    *WHEN CATEGORY
    *IS ACTUAL
    *WHEN BRAND
    *IS <> B_2600
      *WHEN ACCOUNT
      *IS  BAS(GROSS_PREORDER)
        *REC(EXPRESSION=([ACCOUNT].[GROSS_PREORDER]) ,ACCOUNT=GROSS_PREORDER_NOST)
      *ENDWHEN
    *ENDWHEN
    *ENDWHEN
    So if any values are posted on a base member of "GROSS PREORDER"-account, then put it onto GROSS_PREODRE_NOST, but only if CATEGORY = ACTUAL and BRAND different from B_2600.
    The above script works fine, as long as I only post one record at a time, but that's not realistic. The users necessarily need to be able to input data on all base members of GROSS_PREORDER and then send data.
    When you post eg. on three separate accounts below GROSS_PREORDER the result is posted three times onto GROSS_PREORDER_NOST.
    I cannot seem to find a good solution for this, but I don't think I'm the first facing this issue..?
    Best regards
    Mogens
    PS. I am using BPC NW 7.5 SP05

    Hi Nilanjan.
    That works.
    I don't really see why it should work compared to my first script, but isn't that just the irony of script logic..?
    In order to not put every and all data into my sum account I modified
    *WHEN ACCOUNT
      *IS *
    to
    *WHEN ACCOUNT
      *IS BAS(GROSS_PREORDER)
    Thank you very much for your help..
    Br.
    Mogens

  • Futher Calculation on cumulative values

    Dear All,
    I have a key figure Zsales, on that key figure i have made a calculated key figure and in calculation tab i have checked the tab for CUMULATED value. Now i have to perform futher calculations on this calculated key figure, but in report output i am not getting th e desired values the calculation is being performed on original key figure rather than on cumulated values.
    Thanks

    Hi Ravish Singh ,
    Actualy  CKF is global values,once create CKF in query we can use N number of times but we can get same value in all reports.
    if you want change ( or new calculation ) first remove referance (global to local) then only we get correct datas.
    in your query coloum or row select ur CKF then right cilck --->remove referance.firest do this then u will get corect values
    regards,
    sundar

  • Reference a value of previous year in a Script Logic

    Hi,
    I need to reference a value of previous year to that I have in a Script Logic.
    I've tried it with "%YEAR% (-1)", but "%YEAR%" refers to the current year and doesn't refer to the year that I have in the Script Logic, that is, if I pass "2006.DEC " to Script Logic, the system returns me in "%YEAR%" the value "2010".
    What syntax should I use?
    Regards,
    Miguel.

    Hi
    The  Damien's suggestion is the correct one for BPC 7.0 NW to get the offset of the passed-in Time's member.
    So you have properties in your Time dimension that store the prior year of current member or the next year of current member or next 2 years of current member and etc.
    Then reference them in you logic something right this
    ID : 2008.JAN
    NEXT: 2009.JAN
    PRIOR: 2007.JAN
    *WHEN TIME
    *IS %TIME_SET%
    *REC(FACTOR=1, TIME=TIME.PRIOR)
    *ENDWHEN
    Additional information,
    %YEAR% in BPC NW reflects the time on the server which is different from the BPC MS.
    BPC 7.5 NW has a better function to handle this: TVML.
    Halomoan

  • Using cumulated values for further calculation in a bex report

    Hi ya'll,
    I have a problem with using cumulated values in a bex report.
    the report has three lines:
    Values 1:    100    200  300
    Values 2:    10      5     40
    Values 3:    1000  500  4000
    The values of row 3 is a formula multiplying the values from row 1 and 2... My problem is that the values of row 3 are wrong - for example 200*5 isn't supposed to result in 500 !!
    I figure the reason is that the values of row 1 is a cumulated result, meaning the <i>actual</i> value of the second column of the first row i 100 (and not 200).
    How can I ensure that my formula for row 3 uses the <b>cumulated</b> result from row 1, instead of the underlying result ?.

    Create a column structure with Actual Value columns as well as cumulated value columns. Hide Actual Value Columns from display.
    Example :
    Actual1 | Actual 2 | Actual 3 | *** 1 | *** 2 | *** 3 |
    100 | 100 | 100 | 100 | 200 | 300 |
    You can create a forumla to calculate Value 3 : (Actual 1 * Value 2 ).
    I guess you are using Cell Referencing to achieve this.

Maybe you are looking for

  • How to handle no_data_found in Page/Regions/Body/Report

    Hi, I am new to APEX. I have a report in a the Region area of a Page. The Region Source allows me to enter only SELECT statement, no BEGIN/EXCEPTION/END are allowed. How can I handle a no_data_found exception in a report? Many thanks.

  • What happened to "pass lock" after ios 7.1 update? No longer on my iP4S. :(

    (iPhone 4S) Downloaded iOS 7.1 last night and today can't find "pass lock" in my Settings - used to appear below Auto-Lock.  "Restrictions" is now there, but it doesn't lock my device.  Got answers?

  • Change I change project resolution 4:3 16:9? SD HD?

    I started a project in FCE 4 in 4:3 SD format. The project consists solely of text on black background and one photo. Can I change the whole project from 4:3 SD to 16:9 HD?

  • Macbook pro 13" no sound..

    Hey all, I have some strange issues with my macbook pro. Sometimes, it just stops sound output. I have to restart the whole thing to get sound back again. But this is quite annoying and it happens occasionally. Does anyone has a solution to this prob

  • Access Enforcer - Role Reaffirmation

    Hi, Access Enforcer offers a role <-> user assignment reaffirmation after a defined period. My question is, what happens if using the Remove or Hold button in the Role Reaffirm menu entry. I tried removing the access, but all that happens is the user