2

How to calculate KF from Different Aggregation Lev... - SAP Community

 3 months ago
source link: https://community.sap.com/t5/technology-q-a/how-to-calculate-kf-from-different-aggregation-levels-of-data/qaq-p/13602738
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

How to calculate KF from Different Aggregation Levels of Data
Vasu_Sac

Vasu_Sac

Discoverer

5 hours ago

- last edited

35m ago

I am calculating new KF Sales_Input from two KFs which are different aggregation levels, But my code is not populating new KF value. 

Code_MatGroup.png
MatGroup_Level.png

Dimensions Territory Office, Mat Line, Mat Group are multiple selections by user dynamically, hence I couldn't filter in Member selection.

I need to populate new KF (Sales_Input) at MatGroup level. Any help on this highly appreciate. 

Regards,

Accepted Solutions (0)

Answers (1)

N1kh1l

N1kh1l

Active Contributor

3 hours ago

@Vasu_Sac 

Note: Please do not post code block as image. Please provide your code as text so that community can help better.

Your code block should be structured as below. This is assuming that both Sales Forecast and Dales Output are available at same data intersection of other dimensions.

You did not specify at what Material Group the Sales Forecast is stored. If its on each Material Group and you need to add them together then below code will need adjustment as highlighted. 

Dimensions Territory Office, Mat Line, Mat Group are multiple selections by user dynamically, hence I couldn't filter in Member selection. -  This is the selection for the report but I assume your calculations should happen for all members of these dimensions. 

MEMBERSET [d/Date] = (%Date_Input%)
MEMBERSET [d/CompCode] = (%CompCode_Input%)
MEMBERSET [d/SalesGroup] = (%SalesGroup_Input%)
MEMBERSET [d/CustType] = (%CustType_Input%)
MEMBERSET [d/Measures]=("Sales_Forecast", "Sales_Output")

VARIABLEMEMBER #TotalMG of [d/MatGroup]

DATA([d/MatGroup]=#TotalMG)=RESULTLOOKUP([d/Version] = "public.Actual",[d/Measures]="Sales_Forecast",[d/MatGroup]="#") // Remove the bold part if SF is on individual MG like MG1 , MG 2 and you need to aggregate else if its on MG #  you can keep the code block as is

DATA([d/Measures]="Sales_Input")=(RESULTLOOKUP([d/Measures]="Sales_Output")/RESULTLOOKUP([d/MatGroup]=#TotalMG,[d/Version] = "public.Actual",[d/Measures]="Sales_Forecast"))*100

Nikhil


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK