Reply
AK_Micro_User
New Member
Partially syndicated - Outbound

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
v-jiewu-msft
Community Support
Community Support

Syndicated - Outbound

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
v-jiewu-msft
Community Support
Community Support

Syndicated - Outbound

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.

Syndicated - Outbound

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

Syndicated - Outbound

Mixing concepts in the same visual will confuse your users. 

 

Anyway - you can use Visual Calculations to achieve that.

avatar user

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

March2025 Carousel

Fabric Community Update - March 2025

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

Top Solution Authors (Last Month)
Top Kudoed Authors (Last Month)