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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
antlufc
Frequent Visitor

Duplicate Values Making Sub and Grand Totals Incorrect

Hi All

 

I need to calculate a sales value based upon id and stage being closed won. 

 

In my data the "ID" has duplicates, so what i want to do is get the total value of sales without it duplicating. I need to use a dax measure to achieve this.  For example an ID appears twice and it is doubling the sales value.  So with example below in my matrix it showing ID as 200 for the sales value, it should be 100 as this id has been duplicated. 

 

ID       Sales Value

1          100

1           100

2             50

3             50

 

i have used the below to get the show what IDs have been duplicated:

Measure 1 =
 
COUNTROWS(FILTER(VALUES(Table1[Id]),CALCULATE(COUNT(Table1[Id]) > DISTINCTCOUNT(Table1[Id]]))))
 
I have then used the below if statement to get my sales value:
 
IF([Measure 1]=1,SUMX(table1,[Salesvalue])/2,SUMx(Table1,[SalesValue]))
 
This has worked on a row level but not on a subtotal or grand total level.
 
Any idea how i can get the correct values to show in the sub and grand totals?

 

1 REPLY 1
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

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

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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