Forum Discussion
Raptors2019
2 years agoRegular Visitor
Comparing different version's values within same column
Hi everyone! My data set looks like this in PBI. Run_Type (Versions) in picture below goes up to 3, but in reality there's going to be many more different run_types (Versions). I am...
- Anonymous2 years ago
Hi Raptors2019 ,
I create a table as you mentioned.
Then I add a slicer and a matrix into the visual page.
Next I create a measure and put it into the matrix.
Measure = VAR _currentType = MAX ( 'Table'[Run_Type] ) VAR _PreviousType = CALCULATE ( MAX ( 'Table'[Run_Type] ), FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Run_Type] < _currentType ) ) VAR _currentDes = SELECTEDVALUE ( 'Table'[Destination] ) VAR _current = CALCULATE ( SUM ( 'Table'[Total Cost] ), FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Destination] = _currentDes && 'Table'[Run_Type] = _currentType ) ) VAR _previous = CALCULATE ( SUM ( 'Table'[Total Cost] ), FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Destination] = _currentDes && 'Table'[Run_Type] = _PreviousType ) ) RETURN IF ( _previous <> BLANK (), ABS ( _current - _previous ) )Best Regards
Yilong Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
2 years agoNot applicable
Hi Raptors2019 ,
I create a table as you mentioned.
Then I add a slicer and a matrix into the visual page.
Next I create a measure and put it into the matrix.
Measure =
VAR _currentType =
MAX ( 'Table'[Run_Type] )
VAR _PreviousType =
CALCULATE (
MAX ( 'Table'[Run_Type] ),
FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Run_Type] < _currentType )
)
VAR _currentDes =
SELECTEDVALUE ( 'Table'[Destination] )
VAR _current =
CALCULATE (
SUM ( 'Table'[Total Cost] ),
FILTER (
ALLSELECTED ( 'Table' ),
'Table'[Destination] = _currentDes
&& 'Table'[Run_Type] = _currentType
)
)
VAR _previous =
CALCULATE (
SUM ( 'Table'[Total Cost] ),
FILTER (
ALLSELECTED ( 'Table' ),
'Table'[Destination] = _currentDes
&& 'Table'[Run_Type] = _PreviousType
)
)
RETURN
IF ( _previous <> BLANK (), ABS ( _current - _previous ) )
Best Regards
Yilong Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.