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
Anonymous
Not applicable

Total of "visible" values

Hi,

 

I have got a table with Sales LY and this year sales looking like:

 

Month     Sales LY     Sales TY     DIF

Jan           100            150            50

Feb           150           130             -20

Mar           200          50               -150

Apr            100                             

Total         550           330             -220

 

I have made the "DIF" column only calculate the difference when Sales TY is not blank. However, the total row calculates the total difference of all the rows, including those with blank Sales TY.

 

How can I only show the total for the "visible" values in the table? So, the above table should look like:

 

Month     Sales LY     Sales TY     DIF

Jan           100            150            50

Feb           150           130             -20

Mar           200          50               -150

Apr            100                             

Total         550           330             -120

 

Hope you can help 🙂

5 REPLIES 5
harshnathani
Community Champion
Community Champion

HI @Anonymous ,

 

You can create 2 measures

 

Difference = 
IF(MAX('Table'[Sales TY]) = BLANK(), BLANK() ,SUM('Table'[Sales LY]) - SUM('Table'[Sales TY]))

 

DIF = SUMX('Table',[Difference])

 

 

1.jpg

 

Regards,
Harsh Nathani
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

amitchandak
Super User
Super User

@Anonymous , assuming these are measures [Sales TY] , [Sales LY]

New measures like this should work

if(isblank([Sales TY]), blank(), [Sales TY] -[Sales LY])

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
Anonymous
Not applicable

Thank you @amitchandak 

 

However, they are not measures...

 

Maybe its easier if i somehow make them into a measure?

@Anonymous , Try like

if(isblank(sum(Table[Sales TY])), blank(), Sum(Table[Sales TY]) -sum(Table[Sales LY]))

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
Anonymous
Not applicable

@amitchandak 

 

Hmm... that gives me the same result as the "Dif" column.

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.