2025 Mar 13 7:50 PM - edited 2025 Mar 13 7:56 PM
Hi Experts,
I need your help with a data action. I’ve tried several approaches, but have had no luck.
I have three measures: Periodic Cost, Cumulative Cost, and Flag. I want to accumulate the values of Periodic Cost from previous periods and post them into the Cumulative Cost measure for the period marked by the Flag measure (where the Flag value is always "1" for the FLAG Measure).
List of Dimensions : Product, version, date , product and Measure
for example
| Source Values | ||||||||||||||
| Product | Measures | 202501 | 202502 | 202503 | 202504 | 202505 | 202506 | 202507 | 202508 | 202509 | 202510 | 202511 | 202512 | Total |
| Product1 | Periodic COST | 1000 | 3000 | 500 | 4500 | |||||||||
| Product1 | FLAG | 1 | ||||||||||||
| Product2 | Periodic COST | 500 | 650 | 50 | 1200 | |||||||||
| Product2 | FLAG | 1 | ||||||||||||
| Expected Values | ||||||||||||||
| Product1 | Cumulate COST | 4500 | 4500 | 4500 | 4500 | 4500 | 4500 | |||||||
| Product2 | Cumulate COST | 1200 | 1200 |
Request clarification before answering.
Step 1: Calculate Cumulative Cost in a Variable
Step 2: Calculate Cumulative Flag as well to simplify. If blank, 0.
Multiply Cumulative Amount and Flag.
Your result would be something like this.
| 2025.01 | 2025.02 | 2025.03 | 2025.04 | 2025.05 | 2025.06 | 2025.07 | 2025.08 | 2025.09 | 2025.1 | 2025.11 | 2025.12 | ||
| Time | |||||||||||||
| Product | Measures | ||||||||||||
| Product_1 | Amount | 1000 | 500 | 3000 | |||||||||
| Product_1 | Flag | 1 | |||||||||||
| Product_1 | Acc_Amount (Variable) | 1000 | 1000 | 1500 | 1500 | 4500 | 4500 | 4500 | 4500 | 4500 | 4500 | 4500 | 4500 |
| Product_1 | Acc_Flag (Variable) | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 |
| Product_1 | Amount_YTD | 0 | 0 | 0 | 0 | 0 | 4500 | 4500 | 4500 | 4500 | 4500 | 4500 | 4500 |
Sample code to get Accumulated sum using Advanced Formula:
FOREACH [d/Date]
IF [d/Date].[p/FISCAL_PERIODDESC] = "P01" THEN
DATA([d/Measures] = #ACC_AMOUNT) = RESULTLOOKUP([d/Measures] = "PERIODIC_AMOUNT")
ENDIF
DATA([d/Measures] = #ACC_AMOUNT) = RESULTLOOKUP([d/Measures] = #ACC_AMOUNT, [d/Date] = PREVIOUS()) + RESULTLOOKUP([d/Measures] = "PERIODIC_AMOUNT")
ENDFORYou must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Two options:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I couldn't proceed with the Calculated Measure and Copy Step.
How can I identify the Flag Account and post the YTD amount for the particular month?
As I mentioned, there are three accounts: Periodic Cost, Cumulative Cost, and Flag Account (where we need to post values for the particular month).
VARIABLEMEMBER is not getting the previous months data
| User | Count |
|---|---|
| 8 | |
| 7 | |
| 6 | |
| 6 | |
| 5 | |
| 3 | |
| 3 | |
| 3 | |
| 3 | |
| 3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.