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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Rodriguez
Frequent Visitor

SUMX Sub Total showing as Grand Total

Hi All - This is my current formula to calculate a monthly distinct count of serial numbers:

 

 

 

Distinct Serial Numbers RRR = SUMX(
    values(table1[month]),
    CALCULATE(
        DISTINCTCOUNT(table1[serial])
    )
)

 

 

 

 

I initially get the expected results:

 

Rodriguez_0-1675863963698.png

However, if I filter any of the top columns, the total becomes the grand total:

 

Rodriguez_1-1675864018121.png

I have tried hasonefilter on month and on warranty (the column row), to no avail. Any one have a similar issue?

 

 

1 ACCEPTED SOLUTION
v-yangliu-msft
Community Support
Community Support

Hi  @Rodriguez ,

I created some data:

vyangliumsft_0-1676357034061.png

Here are the steps you can follow:

1. Create measure.

Measure = 
var _table1=SUMMARIZE('Table','Table'[Group3],"Value",[Distinct Serial Numbers RRR])
return
IF(
    HASONEVALUE('Table'[Group3]),[Distinct Serial Numbers RRR],SUMX(_table1,[Value]))

2. Result:

vyangliumsft_2-1676357341845.png

 

 

Best Regards,

Liu Yang

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
v-yangliu-msft
Community Support
Community Support

Hi  @Rodriguez ,

I created some data:

vyangliumsft_0-1676357034061.png

Here are the steps you can follow:

1. Create measure.

Measure = 
var _table1=SUMMARIZE('Table','Table'[Group3],"Value",[Distinct Serial Numbers RRR])
return
IF(
    HASONEVALUE('Table'[Group3]),[Distinct Serial Numbers RRR],SUMX(_table1,[Value]))

2. Result:

vyangliumsft_2-1676357341845.png

 

 

Best Regards,

Liu Yang

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

Rodriguez
Frequent Visitor

@Greg_Deckler Hey, really not sure how these videos and articles relate. I am using SUMX, which is only wrong when there is something filtered.

@Rodriguez If you can provide sample data, I can demonstrate.



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!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...
Greg_Deckler
Super User
Super User

@Rodriguez Often ISINSCOPE and/or HASONEVALUE works better than HASONEFILTER. 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



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!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.