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

July 28 - August 9 | Final Round of the Power BI Dataviz World Championships. This is your chance. Learn more

Reply
arashaga
Helper I
Helper I

Issue with the Subtotal using DAX

I have the folowing table ( partial). excel.PNG

 

 

 

 

 

 

 

I use the following DAX measure to get the sum of [# Change 2014-2024] per Occupation. Why I am doing this is becuase I I do not do that for the occupation "Secondary School Teachers, Ex Special/Carrer/Technical Ed" I would get double since  [# Change 2014-2024] is repeted twice based on the [Major (CIP Title)] column for "Multi-/Interdisciplinary Studies, Other. (Primarily Education Majors)" and "Biology/Biological Sciences, General.". Everything comes up good in the matrix table except for the total that should be 11,480 bot 7,110.00 shown below. I guess it had to do with my DAX expression but I don't know how to fix it. Any Ideas?

tabler.PNG

 

 Below is the DAX Measure.

 

Total Demand = sum(UTSATEST[# Change 2014-2024])/DISTINCTCOUNT(UTSATEST[Major (CIP Title)])

 

1 ACCEPTED SOLUTION
Greg_Deckler
Community Champion
Community Champion

OK, so probably something like:

 

Total Demand Intermediate = sum(UTSATEST[# Change 2014-2024])/DISTINCTCOUNT(UTSATEST[Major (CIP Title)])

Total Demand = 
IF(
  HASONEVALUE(UTSATEST[Occupation]),
    [Total Demand Intermediate],
    SUMX(SUMMARIZE(UTSATEST,[Occupation],"__Total",[Total Demand Intermediate]),[__Total])


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...

View solution in original post

5 REPLIES 5
Greg_Deckler
Community Champion
Community Champion

OK, so probably something like:

 

Total Demand Intermediate = sum(UTSATEST[# Change 2014-2024])/DISTINCTCOUNT(UTSATEST[Major (CIP Title)])

Total Demand = 
IF(
  HASONEVALUE(UTSATEST[Occupation]),
    [Total Demand Intermediate],
    SUMX(SUMMARIZE(UTSATEST,[Occupation],"__Total",[Total Demand Intermediate]),[__Total])


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...

Wow. My head is spinning a bit here. Thank you. Is it possible to have all of this as one measure? ( I am sure you have tried to figure that out before posting) but this works.

You could, but in my opinion, best practice would be to keep it separate in order to avoid repeating code.

 

Total Demand Intermediate = sum(UTSATEST[# Change 2014-2024])/DISTINCTCOUNT(UTSATEST[Major (CIP Title)])

Total Demand = 
IF(
  HASONEVALUE(UTSATEST[Occupation]),
    sum(UTSATEST[# Change 2014-2024])/DISTINCTCOUNT(UTSATEST[Major (CIP Title)])
,
    SUMX(SUMMARIZE(UTSATEST,[Occupation],"__Total",sum(UTSATEST[# Change 2014-2024])/DISTINCTCOUNT(UTSATEST[Major (CIP Title)])
),[__Total])

 



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...
Greg_Deckler
Community Champion
Community Champion

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

 

Would need to see your formula for your measure.



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...

Thanks for the reply. I edited the original question and added the DAX measure at the end.

 

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

Fabric Community Sticker Design Challenge Barcelona Carousel

Fabric Community Sticker Challenge - Barcelona 2026

If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!

July Power BI Update Carousel

Power BI Monthly Update - July 2026

Check out the July 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors