Forum Discussion
Measures at a certain granularity
Hey All,
I have a power BI report with dataset (week, business unit, SKU, Inbound, Outbound). I am creating a measure "Subtract" which is Inbounds- outbounds. And then I am creating another measure "Non Negative MEAS1" which basically zero's out whenever inbound> outbound else it returns "Inbound- Outbounds". I am creating this measure at SKU grain because I want the "Overall" to be a sum of individual "Non-Negative MEAs1" at SKU grain. I have below code so far but somehow the total doesn't sum up each week's data. Instead it's just adding data for the first week.
5 Replies
- AnonymousNot applicable
Hi Anonymous ,
It sounds like nest aggregation calculated requirement, you can add a variable table to your measure formula to manually summary the original table and add temp columns to store measure result 'inbound' and 'outbound'.
After these steps, you can use iteration functions to the summary above variable table result.
Regards,
Xiaoxin Sheng
- AnonymousNot applicable
Could you please show me in the power bi attached? I am very new here and don't really know who will it work
- AnonymousNot applicable
Hi Anonymous ,
You can try to use the following measure formula to manually summary with measure inbound, outbound and calculate out diff:
NonNegMeas = SUMX ( SUMMARIZE ( 'Table', [Week], [BU], 'Table'[SKU], "Diff", SUM ( 'Table'[Inbounds] ) - SUM ( 'Table'[Outbounds] ) ), IF ( [Diff] < 0, 0, [Diff] ) )Notice: replace the bold part with your measure formula 'inbound', 'outbound'.
If above not helps, can you please share pbix file with dummy data and calculate column formulas for test? (I'm not so clear your original table data structure and Dax formulas)
Regards,
Xiaoxin Sheng