Forum Discussion
mattterriault
5 years agoFrequent Visitor
Apply Filter Before Calculation
The formula I have below works but not when I do a filter. I am trying to get the lowest value in a group and assign a 1 to it and 0 when it is not the lowest value. Can I add a If filtered or someth...
- Anonymous5 years ago
Hi mattterriault ,
Please create another new measure with below formula to replace the measure [Lowest Value] on the matrix:
Measure = SUMX ( VALUES ( 'Table'[Distance] ), SUMX ( VALUES ( 'Table'[Distance] ), [Lowest Value] ) )Or you can refer the method to fix the incorrect total value problem:
Fixing Incorrect Measure Totals
Why Your Total Is Incorrect In Power BI
Best Regards
Community Support Team _ Rena Ruan
If this post helps, then please consider Accept it as the solution to help the other members find it more.
DataInsights
5 years agoSuper User
Try this measure. The reason that your calculated column did not work properly is that calculated columns are not affected by filter context.
Lowest Value =
VAR vScore =
MAX ( Table[Score] )
VAR vGroupMinValue =
CALCULATE ( MIN ( Table[Score] ), ALLSELECTED ( Table[Company] ) )
VAR vResult =
IF ( vScore = vGroupMinValue, 1, 0 )
RETURN
vResult