Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
Raptors2019
Regular 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). 

 

Raptors2019_1-1720276765448.png

 

I am looking to select any two different run_types in the two independent slicers I have created and be able to easily compare the KPIs between the two run_types, as well as having a column for % difference. So, the desired matrix would look something like this. I wnt to ensure also that Run_Type A is always before Run_Type B in the matrix.

I am really stuck. Any help on this would be greatly appreciated!

Raptors2019_2-1720276889256.png

 

Thanks!

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Raptors2019 ,

I create a table as you mentioned.

vyilongmsft_0-1720503804654.png

Then I add a slicer and a matrix into the visual page.

vyilongmsft_1-1720503879608.png

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 ) )

vyilongmsft_2-1720503976387.png

vyilongmsft_3-1720504096101.png

 

 

 

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.

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @Raptors2019 ,

I create a table as you mentioned.

vyilongmsft_0-1720503804654.png

Then I add a slicer and a matrix into the visual page.

vyilongmsft_1-1720503879608.png

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 ) )

vyilongmsft_2-1720503976387.png

vyilongmsft_3-1720504096101.png

 

 

 

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.

foodd
Super User
Super User

Hello @Raptors2019 , remember to adhere to the decorum of the Community Forum when asking a question.

Please provide your work-in-progress Power BI Desktop file (with sensitive information removed) that covers your issue or question completely in a usable format (not as a screenshot).

https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...

Please show the expected outcome based on the sample data you provided.

https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

This allows members of the Forum to assess the state of the model, report layer, relationships, and any DAX applied.

Thank you for the feedback! It's my first time posting so did not know! I don't feel comfortable sharing the Power Bi as it has all sensitive info. In fact, the charts I shared is all made up data I created in order to be able to post this question.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.