Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
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
| Data | ID | Date | Result | ID | Dups | |
| 1 | 1/1/2021 | 1 | 1 | |||
| 9 | 1/2/2021 | 2 | 2 | |||
| 2 | 1/3/2021 | 4 | 1 | |||
| 4 | 1/4/2021 | 7 | 1 | |||
| 7 | 1/5/2021 | 9 | 3 | |||
| 9 | 1/2/2021 | |||||
| 9 | 1/2/2021 | |||||
| 2 | 1/3/2021 |
Solved! Go to Solution.
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!
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
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!
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 14 | |
| 7 | |
| 4 | |
| 4 | |
| 3 |
| User | Count |
|---|---|
| 23 | |
| 10 | |
| 10 | |
| 6 | |
| 5 |