Forum Discussion
Rhodes
6 years agoFrequent Visitor
Need Help calculating % Diff of multiple events and returning smallest difference in dax
Greetings. I have a table in the following format: I am attempting to create a table that looks like the one shown below but instead of the row subtotal it would show the % difference o...
- 6 years ago
Hi,
Please try this measure:
Measure = var a = CALCULATE(SUM('Table'[Value]),FILTER(ALLSELECTED('Table'),'Table'[Data Type]="Event AverageModel Flow"&&'Table'[Calibration Event] in FILTERS('Table'[Calibration Event])&&'Table'[Metershed] in FILTERS('Table'[Metershed]))) var b = CALCULATE(SUM('Table'[Value]),FILTER(ALLSELECTED('Table'),'Table'[Data Type]="Event AverageObserved Flow"&&'Table'[Calibration Event] in FILTERS('Table'[Calibration Event])&&'Table'[Metershed] in FILTERS('Table'[Metershed]))) return IF(ISINSCOPE('Table'[Data Type]),FORMAT(SUM('Table'[Value]),"Fixed"),FORMAT((b-a)/a,"Percent"))The result shows:
Here is my test pbix file:
Hope this helps.
Best Regards,
Giotto Zhi
v-gizhi-msft
Community Support
6 years agoHi,
Please try this measure:
Measure =
var a = CALCULATE(SUM('Table'[Value]),FILTER(ALLSELECTED('Table'),'Table'[Data Type]="Event AverageModel Flow"&&'Table'[Calibration Event] in FILTERS('Table'[Calibration Event])&&'Table'[Metershed] in FILTERS('Table'[Metershed])))
var b = CALCULATE(SUM('Table'[Value]),FILTER(ALLSELECTED('Table'),'Table'[Data Type]="Event AverageObserved Flow"&&'Table'[Calibration Event] in FILTERS('Table'[Calibration Event])&&'Table'[Metershed] in FILTERS('Table'[Metershed])))
return
IF(ISINSCOPE('Table'[Data Type]),FORMAT(SUM('Table'[Value]),"Fixed"),FORMAT((b-a)/a,"Percent"))The result shows:
Here is my test pbix file:
Hope this helps.
Best Regards,
Giotto Zhi
Rhodes
6 years agoFrequent Visitor
Thanks that worked!