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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
DoubleTap
New Member

Need help finding duplicate Id's

I think i have a relatively easy ask but im going crazy. I have a table where i need to count the duplicate Id's. I create a simple count measure [ ID_Cnt=count(Id) ] then created another measure to identify the dups [ Duplicate_Cnt = if(ID_Cnt > 1), 1 , 0) ]. It just adds up all the Id's as if the condition wasnt even there. I would like to be to have the total number of duplicates associated with the ID and one measure that has the total count of all overall dups. 

 

Any help is appreciated. 

Here is an example of the data and my desired output:

Duplicates = 5 

 

DataIDDate ResultIDDups
 11/1/2021  11
 91/2/2021  22
 21/3/2021  41
 41/4/2021  71
 71/5/2021  93
 91/2/2021    
 91/2/2021    
 21/3/2021    
1 ACCEPTED SOLUTION
vicky_
Super User
Super User

vicky__0-1712267213021.png

 

Duplicates = 
var aaa = ADDCOLUMNS(VALUES('Table'[ID]), "count id", CALCULATE(COUNT('Table'[ID])))
return IF(
    HASONEVALUE('Table'[ID]), SUMX(aaa, [count id]),
    SUMX(FILTER(aaa, [count id] > 1), [count id])
)

 

EDIT - misread the requirements, have changed the calculation. The above is my attempt. I hope it helps!


View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @DoubleTap ,

Did the above suggestions help with your scenario? if that is the case, you can consider Kudo or Accept the helpful suggestions to help others who faced similar requirements.

If these also don't help, please share more detailed information and description to help us clarify your scenario to test.

How to Get Your Question Answered Quickly 

Regards,

Xiaoxin Sheng

vicky_
Super User
Super User

vicky__0-1712267213021.png

 

Duplicates = 
var aaa = ADDCOLUMNS(VALUES('Table'[ID]), "count id", CALCULATE(COUNT('Table'[ID])))
return IF(
    HASONEVALUE('Table'[ID]), SUMX(aaa, [count id]),
    SUMX(FILTER(aaa, [count id] > 1), [count id])
)

 

EDIT - misread the requirements, have changed the calculation. The above is my attempt. I hope it helps!


Works perfectly thank you so much!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.