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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
AK_Micro_User
New Member

Table with three columns, how to calculate the difference of only two of those columns.

I have a matrix I am creating. The columns are only three years of activity and I want to show the difference between only the two final years while still showing the first year.

 

The matrix currently looks like this

AK_Micro_User_0-1723659342721.png

 

I want to add a column that is the Difference between 2024 and 2025, but 2023 needs to remain in the table.

 

The data UI is like this:

AK_Micro_User_1-1723659388724.png

 

And this is the actual table

AK_Micro_User_2-1723659412502.png

 

 

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @AK_Micro_User ,

Based on my testing, please try the following methods:

1.Create the measure to calculate difference.

Difference 2024 - 2025 = 
VAR Amount2024 = 
    CALCULATE(
        SUM('Test Data'[Amount]),
        'Test Data'[Year] = 2024
    )
VAR Amount2025 = 
    CALCULATE(
        SUM('Test Data'[Amount]),
        'Test Data'[Year] = 2025
    )
RETURN
IF(SELECTEDVALUE('Test Data'[Year]) = 2024, Amount2024 - Amount2025, BLANK())

2.Drag the measure into the matrix visual.

vjiewumsft_0-1723688515002.png

3.The result is shown below.

vjiewumsft_1-1723688542097.png

What’s more, set the wrap in the format visual.

vjiewumsft_2-1723688548556.png

Drag the  border to hide the other difference.

vjiewumsft_3-1723688555474.png

 

Best Regards,

Wisdom Wu

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 @AK_Micro_User ,

Based on my testing, please try the following methods:

1.Create the measure to calculate difference.

Difference 2024 - 2025 = 
VAR Amount2024 = 
    CALCULATE(
        SUM('Test Data'[Amount]),
        'Test Data'[Year] = 2024
    )
VAR Amount2025 = 
    CALCULATE(
        SUM('Test Data'[Amount]),
        'Test Data'[Year] = 2025
    )
RETURN
IF(SELECTEDVALUE('Test Data'[Year]) = 2024, Amount2024 - Amount2025, BLANK())

2.Drag the measure into the matrix visual.

vjiewumsft_0-1723688515002.png

3.The result is shown below.

vjiewumsft_1-1723688542097.png

What’s more, set the wrap in the format visual.

vjiewumsft_2-1723688548556.png

Drag the  border to hide the other difference.

vjiewumsft_3-1723688555474.png

 

Best Regards,

Wisdom Wu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you so much! I am still so new to DAX that seeing it written out from the perspective of my data is incredibly useful. The hiding columns trick is also great to know.

lbendlin
Super User
Super User

Mixing concepts in the same visual will confuse your users. 

 

Anyway - you can use Visual Calculations to achieve that.

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.

Top Solution Authors