Forum Discussion
Anonymous
6 years agoNot applicable
Help with the Dax Expression.
Hello guys, I have a table and a slicer like the following: I'm looking to write an DAX expression for the following logic : I need to find the Maximum value of the Diff column corresp...
- 6 years ago
Hi Anonymous ,
Update the formula as below.
Measure 2 = VAR maxp = MAX ( 'Table'[req total pos] ) VAR kk = TOPN ( maxp, FILTER ( 'Table', 'Table'[Elim or keep] <> "Elim" ), 'Table'[Ass Number], ASC ) VAR c = CALCULATE ( MAX ( 'Table'[Ass Number] ), KEEPFILTERS ( kk ) ) RETURN CALCULATE ( MAX ( 'Table'[Diff] ), FILTER ( 'Table', 'Table'[Ass Number] = c ) )
v-frfei-msft
6 years agoCommunity Support
Hi Anonymous ,
We can create a measure as below.
Measure 2 =
VAR maxp =
MAX ( 'Table'[req total pos] )
VAR kk =
TOPN ( maxp, 'Table', 'Table'[Ass Number], ASC )
VAR c =
CALCULATE ( MAX ( 'Table'[Ass Number] ), KEEPFILTERS ( kk ) )
RETURN
CALCULATE ( MAX ( 'Table'[Diff] ), FILTER ( 'Table', 'Table'[Ass Number] = c ) )
For more details, please check the pbix as attached.
- Anonymous6 years agoNot applicable
Thanks for the response and it works great! But as I had mentioned, I should also filter out the rows with "Elim". Where do I include that filter in your code?
- v-frfei-msft6 years agoCommunity Support
Hi Anonymous ,
Update the formula as below.
Measure 2 = VAR maxp = MAX ( 'Table'[req total pos] ) VAR kk = TOPN ( maxp, FILTER ( 'Table', 'Table'[Elim or keep] <> "Elim" ), 'Table'[Ass Number], ASC ) VAR c = CALCULATE ( MAX ( 'Table'[Ass Number] ), KEEPFILTERS ( kk ) ) RETURN CALCULATE ( MAX ( 'Table'[Diff] ), FILTER ( 'Table', 'Table'[Ass Number] = c ) )