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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
mkim
Regular Visitor

Create a calculated column in matrix visualization

I've been reading other forums but still am not able to figure it out. I'm looking to create a new measure subtracting the first column (2011-12) from the last column (2015-16). How do I calculate the total difference between the 2 years? When I try to create the measure, I can select that field but can't filter down to a specific year. 

 

mkim_0-1606059294620.png

 

2 ACCEPTED SOLUTIONS
Fowmy
Super User
Super User

@mkim 

Adding a Measure to a Matrix will always show calculation against each Row and Column fields, to hide the values, you can create the following measure, adjust your measure accordingly:

Diff = 
IF(
    ISFILTERED( Table3[YEAR] ) , "" , 
    CALCULATE(
        SUM(Table3[VALUE]),
        Table3[YEAR] = 2016
    ) - 
    CALCULATE(
        SUM(Table3[VALUE]),
        Table3[YEAR] = 2014
    )
)

________________________

If my answer was helpful, please consider Accept it as the solution to help the other members find it

Click on the Thumbs-Up icon if you like this reply 🙂

YouTube  LinkedIn



Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

Anonymous
Not applicable

Hi @mkim ,

 

Based on your description, you can do some steps as follows.

  1. Create an index column.
  2. Create two date tables.

 

Current date = SUMMARIZE('Case3',Case3[index],Case3[DATE])

Prior date = SUMMARIZE('Case3',Case3[index],Case3[DATE])

 

3. Create a measure.

 

diff =

var cu1=MIN('Current date'[index])

var cu2=MAX('Current date'[index])

var pr1=MIN('Prior date'[index])

var pr2=MAX('Prior date'[index])

return

CALCULATE(SUM(Case3[VALUE]),'Case3'[index]>=cu1&&'Case3'[index]<=cu2)-CALCULATE(SUM(Case3[VALUE]),'Case3'[index]>=pr1&&'Case3'[index]<=pr2)

  4.Create two clicers.

Result:

 

v-yuaj-msft_3-1606265402505.png

 

Hope that's what you were looking for.

Best Regards,

Yuna

 

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

4 REPLIES 4
Anonymous
Not applicable

Hi @mkim ,

 

Based on your description, you can do some steps as follows.

  1. Create an index column.
  2. Create two date tables.

 

Current date = SUMMARIZE('Case3',Case3[index],Case3[DATE])

Prior date = SUMMARIZE('Case3',Case3[index],Case3[DATE])

 

3. Create a measure.

 

diff =

var cu1=MIN('Current date'[index])

var cu2=MAX('Current date'[index])

var pr1=MIN('Prior date'[index])

var pr2=MAX('Prior date'[index])

return

CALCULATE(SUM(Case3[VALUE]),'Case3'[index]>=cu1&&'Case3'[index]<=cu2)-CALCULATE(SUM(Case3[VALUE]),'Case3'[index]>=pr1&&'Case3'[index]<=pr2)

  4.Create two clicers.

Result:

 

v-yuaj-msft_3-1606265402505.png

 

Hope that's what you were looking for.

Best Regards,

Yuna

 

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

amitchandak
Super User
Super User

@mkim , If you need such a difference dynamically, Then you need two date /year table. Refer my blog on that. It if for date range , but you can use year slicer from date table in place of Date.

 

https://community.powerbi.com/t5/Community-Blog/Comparing-Data-Across-Date-Ranges/ba-p/823601

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Fowmy
Super User
Super User

@mkim 

Adding a Measure to a Matrix will always show calculation against each Row and Column fields, to hide the values, you can create the following measure, adjust your measure accordingly:

Diff = 
IF(
    ISFILTERED( Table3[YEAR] ) , "" , 
    CALCULATE(
        SUM(Table3[VALUE]),
        Table3[YEAR] = 2016
    ) - 
    CALCULATE(
        SUM(Table3[VALUE]),
        Table3[YEAR] = 2014
    )
)

________________________

If my answer was helpful, please consider Accept it as the solution to help the other members find it

Click on the Thumbs-Up icon if you like this reply 🙂

YouTube  LinkedIn



Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

newpowerbiuser8_0-1678397131991.png

 

Hi @amitchandak @Fowmy 

 

I am confused. I have excel table which when converted to powerbi mtarix is showing unique values for each ctagory, which is correct, the the total is showing is incorrect. It is only counting unique values however if you see, Jeans order apperas twice so it should calculate total based on unique category. I know power BI doesnt let that happen automcatlly, can you please tell a work around?

 

Thanks a lot

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors