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.
It baffles me that in 2025 there is still no clean option to do this requirement.
I am aware of the ISINSCOPE/ISFILTERED/HASONEVALUE options with the deactivation of word wrap, etc. But this solution is absolutely not future proof as if new values appear in the column headers, you have to manually hide these new column headers (even if the value of the measure is blank).
Sometimes Power BI really grinds my gear...
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
- gck021 year agoAdvocate I
Great, thanks for the input.
Guess I'll have to learn how these calculation groups work.