Forum Discussion
Anonymous
4 years agoNot applicable
How to get difference between two columns in Matrix based on slicer selection of Year in Power Bi
- 4 years ago
Hi Anonymous
Here you go https://www.dropbox.com/t/sMyzwonHckNHvdKX
Original Measure code remains the sameMeasure = COUNTROWS ( DISTINCT ('Table'[Value] ) )New Measure code is
Measure1 = VAR MaxYear = MAX ( 'Table'[Year] ) VAR MinYear = MIN ( 'Table'[Year] ) VAR MaxYearValue = CALCULATE ( [Measure], 'Table'[Year] = MaxYear ) VAR MinYearValue = CALCULATE ( [Measure], 'Table'[Year] = MinYear ) VAR Difference = MaxYearValue - MinYearValue VAR Result = SWITCH ( TRUE, NOT HASONEVALUE ( 'Table'[Year] ), Difference, COUNTROWS ( ALLSELECTED ('Table'[Year] ) ) = 1, BLANK(), [Measure] ) RETURN Result
Anonymous
4 years agoNot applicable
I replaced values with codes . My requirement is look like this . I categorized them as distinct count ( from column tools ) .What I want is exactly like your output . Measure 1 is exactly corect . I think we need to modify the Measure , with codes (Distinct Count ) .Please modify the dax .,It would work fine. Am unable tho send the file .
Kudos !
Thanks for such quick response
tamerj1
Community Champion
4 years agoHi Anonymous
Here you go https://www.dropbox.com/t/sMyzwonHckNHvdKX
Original Measure code remains the same
Measure = COUNTROWS ( DISTINCT ('Table'[Value] ) )New Measure code is
Measure1 =
VAR MaxYear = MAX ( 'Table'[Year] )
VAR MinYear = MIN ( 'Table'[Year] )
VAR MaxYearValue =
CALCULATE (
[Measure],
'Table'[Year] = MaxYear
)
VAR MinYearValue =
CALCULATE (
[Measure],
'Table'[Year] = MinYear
)
VAR Difference = MaxYearValue - MinYearValue
VAR Result =
SWITCH (
TRUE,
NOT HASONEVALUE ( 'Table'[Year] ), Difference,
COUNTROWS ( ALLSELECTED ('Table'[Year] ) ) = 1, BLANK(),
[Measure]
)
RETURN
Result
- Anonymous4 years agoNot applicable
Thank You So Much Tamerj1 .
You deserve to be a super user .
Kudos ! Kudos !