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

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

Reply
Leh
New Member

Subtotal includes blank values

Hello,

 

I need some help getting the subtotal to show the correct value in a Table Matrix by using DAX if possible, rather than using the filter on the page.

 

Below is a screenshot of my expected result and my current "workaround".  My concern with the current workaround is that placing a filter on the page may cause issues with other measures that I will add to the report.

 

Expected Results (even without page filter)Expected Results (even without page filter)

 

The first column calculates all the time entered by a technician for a particular job.  The second and third columns calculate the total hours entered by all technicians for a particular job.  The difference between the second and third columns is that the former excludes the blank lines if the first column is blank.

 

Below is the result if I remove the page filter, notice that the Hours Blank measure calculates each line correctly, but the subtotal is off.

 

Wrong subtotal calculationWrong subtotal calculation

 

I wanted the report to show the Subtotal for Hours Blank measure excludes the values of the Labor Hours that the technician has not entered time against.  This is just the tip of the iceberg because later on, I will add another measure for Cost and Billing (this measure has no tie to the Technician but to the Job Number); that is why I wanted to write a measure that is not dependent to the Page Filters.

 

Here is the link to the sample data in the Excel file.   Sample Data Excel 

Here is the link to the PBIX. Subtotal and Grand Total for Job and Technician.pbix 

 

I would greatly appreciate any help.

1 ACCEPTED SOLUTION

Hi,

Write this measure

Hours Blank = SUMX(FILTER(VALUES(Jobs[Job  Number]),[Technician Labor Hours]<>BLANK()),[All Labor Hours])

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

8 REPLIES 8
Leh
New Member

Hi @grantsamborn ,

 

I am not sure what happened there, but can you try the link below?

 

PBIX Link 

 

Thank you.

Hi @Leh 

That worked.

Thanks

Hi,

Write this measure

Hours Blank = SUMX(FILTER(VALUES(Jobs[Job  Number]),[Technician Labor Hours]<>BLANK()),[All Labor Hours])

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Thank you very much @Ashish_Mathur .

 

This has worked wonders for my report.

 

I just do not want to blindly follow the DAX measure that resolved my issues.  If you have time and patience, can you indulge me by answering if I understood the measure correctly?  I mean I tried both SUMX and FILTER in my testing but somehow didn't get the desired result as your measure has.  I guess I just couldn't follow the concept of sequence or how to envelope the DAX code to get the desired result.

 

Looking at the measure, the "FILTER(VALUES..." evaluates each row if the [Techinician Labor Hours] at the Job Number level is blank and excludes that row in summing up the [All Labour Hours] measure that already strips all the filters by using "ALL(..". Is that the right interpretation? 

 

Thank you again.

You are welcome.  That is correct.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Greg_Deckler
Community Champion
Community Champion

@Leh First, please vote for this idea: https://ideas.powerbi.com/ideas/idea/?ideaid=082203f1-594f-4ba7-ac87-bb91096c742e

This looks like a measure totals problem. Very common. See my post about it here: https://community.powerbi.com/t5/DAX-Commands-and-Tips/Dealing-with-Measure-Totals/td-p/63376

Also, this Quick Measure, Measure Totals, The Final Word should get you what you need:
https://community.powerbi.com/t5/Quick-Measures-Gallery/Measure-Totals-The-Final-Word/m-p/547907

Also: https://youtu.be/uXRriTN0cfY
And: https://youtu.be/n4TYhF2ARe8

 

Maybe this specifically: Matrix Measure Total Triple Threat Rock & Roll - Microsoft Power BI Community



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Thank you, @Greg_Deckler .

 

I'll see what I can dig up from the links provided.

 

I also voted as requested.  The idea was posted 5 years ago, not sure if one vote helps.  .

grantsamborn
Solution Sage
Solution Sage

Hi @Leh 

Both are links to SampleData.xlsx

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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