Forum Discussion
Showing a Measure as a Total Column only on Matrix
- 4 years ago
Hi Imrans123 ,
According to your formula, in a measure, MAX and MIN will return the current value according to context, not the max or min value of the column, for example the Difference marked by the red line calculate by your formula is (12.2-12.2)/12.2=0.
You can get a better understanding of context through this article:Context in DAX Formulas
Here's my solution.
Difference = VAR _MAX = MAXX ( FILTER ( ALL ( Sheet1 ), 'Sheet1'[Item Code] = MAX ( 'Sheet1'[Item Code] ) ), 'Sheet1'[Price] ) VAR _MIN = MINX ( FILTER ( ALL ( Sheet1 ), 'Sheet1'[Item Code] = MAX ( 'Sheet1'[Item Code] ) ), 'Sheet1'[Price] ) RETURN DIVIDE ( _MAX - _MIN, _MIN )Get the result.
Reference for MAXX and MINX function: MAXX function (DAX) - DAX | Microsoft Docs
MINX function (DAX) - DAX | Microsoft Docs
I attach my sample below for reference.
Best Regards,
Community Support Team _ kalyjIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
I had a similar requirement and came across a video that used a calculation group in a matrix to achieve this.
Video:
Calculation Group further readings:
Create calculation groups in Power BI - Power BI | Microsoft Learn
Great, thanks for the input.
Guess I'll have to learn how these calculation groups work.