2025 Mar 11 5:41 AM - edited 2025 Mar 11 6:51 AM
Hey all,
can anyone of you help me need to calculate the product of aggregated account dimensions (Units and Lookup Price) across the Product and Time dimensions. However, when I directly multiply these accounts using Data Actions, the calculation is performed row-wise first and then aggregated, leading to incorrect results. Instead, I want to first aggregate the values by Product and Time and then perform the multiplication to ensure accuracy. Can anyone help me with how to achieve this using scripting? I have to claculate the Revenue NA for NorthEast Region
please help this is the code that I wrote just to check th value for units only but no result is appearing
MEMBERSET [d/ENTITY] = "REG0001"
VARIABLEMEMBER #SUMOFUNITS OF [d/ACCOUNT]
DATA([d/ACCOUNT]=#SUMOFUNITS, [d/PRODUCT]="#") = RESULTLOOKUP ([d/ACCOUNT] = "DRV0020" )
DATA([d/ACCOUNT] = "DRV0060" ) = RESULTLOOKUP([d/ACCOUNT] = #SUMOFUNITS , [d/PRODUCT]= "#")
alternative workaround but still values are not appearing
MEMBERSET [d/ENTITY] = "REG0001"
MEMBERSET [d/ACCOUNT] = "DRV0020"
AGGREGATE_DIMENSIONS = [d/PRODUCT],[d/ACCOUNT]
AGGREGATE_WRITETO [d/ACCOUNT] = "DRV0060"
AGGREGATE_WRITETO [d/PRODUCT] = "#"
Request clarification before answering.
Hi @SANA11
Please refer to the Advanced formulas script and validate the calculated result.
MEMBERSET [d/Entity] = "REG0001"
VARIABLEMEMBER #All_Product OF [d/PRODUCT]
//Aggregate "Units" & "Lookup_Price" of Product and write it on VARIABLEMEMBER #All_Product
DATA([d/PRODUCT] = #All_Product) = RESULTLOOKUP()
//Calculate Revenue to multiply Aggregated "Units" & "Lookup_Price" of Product and write it on Product "#" and Account "Revenue"
DATA([d/PRODUCT] = "#", [d/Account] = "Revenue") = RESULTLOOKUP([d/PRODUCT] = #All_Product, [d/Account] = "Units") *
RESULTLOOKUP([d/PRODUCT] = #All_Product, [d/Account] = "Lookup_Price")
I don't have an idea about the Account dimension Member ID, so please replace it with your actual Account dimension Member ID, which is Account dimension member description is listed in my script.
I hope this is helpful to you, and if I have misunderstood anything, please feel free to reach out.
moonjun
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
MoonJun appreciating your response I have executed the code but still incorrect value is appearing
MEMBERSET [d/ENTITY] = "REG0001"
MEMBERSET [d/ACCOUNT] = ("DRV0020","DRV0055")
VARIABLEMEMBER #All_Product OF [d/PRODUCT]
DATA([d/PRODUCT] = #All_Product) = RESULTLOOKUP()
DATA([d/PRODUCT] = "#", [d/ACCOUNT]= "DRV0060") = RESULTLOOKUP([d/PRODUCT] = #All_Product, [d/ACCOUNT] = "DRV0020") *
RESULTLOOKUP([d/PRODUCT] = #All_Product, [d/ACCOUNT] = "DRV0055")
the actual value has to be 103,170,905,160 please assist
Hi @SANA11
Please let me know all dimensions of your Model. It seems to be more dimensions and the current aggregate value has a dimensionality. To get your expected result, the other dimensions should also be aggregated.
Regards,
Moonjun.
Hi @SANA11
Please refer to the below script.
It seems that aggregating only the DATE dimension would be sufficient to achieve the desired result, but the Audit and Flow dimensions were also aggregated.
MEMBERSET [d/Entity] = "REG0001"
VARIABLEMEMBER #All_Product OF [d/PRODUCT]
//Aggregate "Units" & "Lookup_Price" of Produdt, Flow, Audit and Date members and write it on VARIABLEMEMBER #All_Product
DATA([d/PRODUCT] = #All_Product, [d/Date] = "201801", [d/FLOW] = "#", [d/AUDIT] = "#") = RESULTLOOKUP()
//Calculate Revenue to multiply Aggregated "Units" & "Lookup_Price" of Product and write it on Product "#" and Account "Revenue"
DATA([d/PRODUCT] = "#", [d/Date] = "201801", [d/FLOW] = "#", [d/AUDIT] = "#", [d/Account] = "DRV0060") =
RESULTLOOKUP([d/PRODUCT] = #All_Product, [d/Date] = "201801", [d/FLOW] = "#", [d/AUDIT] = "#", [d/Account] = "DRV0020") *
RESULTLOOKUP([d/PRODUCT] = #All_Product, [d/Date] = "201801", [d/FLOW] = "#", [d/AUDIT] = "#", [d/Account] = "DRV0055")
Regards,
Moonjun
User | Count |
---|---|
72 | |
21 | |
8 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.