2024 Jun 06 9:23 AM - edited 2024 Jun 06 9:25 AM
I am trying to distribute some values using a data action, in this example of Plan 2023 from an unassigned member, to the members of Product A and Product B of Product Dimension. I want the distribution to be based on the weight of Products of the Actuals of 2023. For simplicity I differentiate the Actuals and Plan using a dimension called "value type" (Actuals have the value 010 and Plan the 020).
I tried applying the following code:
//Define the membersets
MEMBERSET [d/Product]=("Product A","Product B")
MEMBERSET [d/Date].[p/YEAR]="2023"
MEMBERSET [d/Company_Code]="Company A"
MEMBERSET [d/Value_Type]=("020")
//Define variables
VARIABLEMEMBER #Weight OF [d/Product]
VARIABLEMEMBER #SumProduct OF [d/Product]
// Step 1: Calculate Total Actuals for 2023
DATA([d/Product]=#SumProduct)=RESULTLOOKUP([d/Measures]="Measure",
[d/Version]="public.Actual",
[d/Value_Type]="010",
[d/Date]="2023",
[d/Company_Code]="Company A")
//Step 2: Calculate Distribution Weights
FOREACH [d/Product]
DATA([d/Measures]="Measure", [d/Product]=#Weight)=RESULTLOOKUP([d/Measures]="Measure",
[d/Version]="public.Actual",
[d/Value_Type]="010",
[d/Date]="2023",
[d/Company_Code]="Company A")
/ RESULTLOOKUP([d/Product]=#SumProduct)
ENDFOR
//Step 3: Distribute the values
DATA()=RESULTLOOKUP([d/Product]="#",
[d/Version]="public.Actual",
[d/Value_Type]="020",
[d/Date]="2023",
[d/Company_Code]="Company A")
* RESULTLOOKUP([d/Product]=#Weight)
//Step 4: Delete the data from "Unassigned" after the distribution
DATA([d/Date]="2023",[d/Product]="#",[d/Value_Type]="020")=0
Do you have any suggestions?
Thanks in advance.
@N1kh1l Thanks again for you valuable input. Now I am trying to apply the logic to a more complex model containing several dimensions and looks like this.
I also have several other dimensions but I did not include them in my meberset. Now the value type for Actuals is 010, and for Forecast is 061. The adapted code is the follwing:
Unfortunately it does not work. Should I also include all the dimensions in the lines of Forecast 1? And how can I make the Local Branch selection dynamic so It is applied for the specific local branches in every case (maybe a parameter with fixed value as story filter?)?
Thanks in advance.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
68 | |
9 | |
8 | |
7 | |
7 | |
6 | |
6 | |
6 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.