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
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
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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.