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
Patrick95
Frequent Visitor

Subtotals from DISTINCTCOUNT in matrix incorrect (same ID on different days)

Hi,

 

I've created a measure to calculate the distinct "Document No." when they have a certain value (FILTER ON: '42-CHECK-SERIALNO'). 

It could be that the same Document No. will have the value (42-...) on a different date. 

 

The totals are corrrect in the matrix, but the subtotals will count the value even if the Document No. has already hit the value (42-CHECK-SERIALNO) already on a different date. Herefor if you count the subtotals, you will get a different total als the one that is listed correctly in the matrix.

 

If the "Document No." occurs several times on different dates by value (42-...), then I do not want to count this (double) in the subtotals. It should only count the first time the "Document No." hits the status (42-...)

 

Patrick95_0-1661431928971.png

 

Patrick95_1-1661432367386.png

 

I hope someone can help me with this issue

 

@v-luwang-msft 

 

 

1 ACCEPTED SOLUTION

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


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

View solution in original post

4 REPLIES 4
Patrick95
Frequent Visitor

Hi, 

 

@Ashish_Mathur, I reproduced the data and you can find the link below:

Subtotals

 

Again: 

If the "Document No." occurs several times on different dates by value (42-...), then I do not want to count this (double) in the subtotals. It should only count the first time the "Document No." hits the status (42-...)

 

 

Example below:

 

Patrick95_0-1661765164849.png

Patrick95_1-1661765260910.png

 

 

https://drive.google.com/file/d/1SomsPthm_U_uVwPQp8deBlLWQpJOnNH2/view?usp=sharing

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


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

@Patrick95 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



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

Hi Greg,

 

Thanks for your response, but I think I'm looking for something more specific. I want an IF statement on my formula so ifthe "Document No." occurs several times on different dates by value (42-...), then I do not want to count this (double) in the subtotals. It should only count the first time the "Document No." hits the status (42-...).

 

Do you have experience with this or have a solution? 

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.

Top Solution Authors