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
Hi All,
I have the following table :
| ID | Code | Date | Composite |
| 1 | 2820 | 14.07.2024 | |
| 2 | 1292 | 01.06.2024 | |
| 3 | 5869 | 01.01.2024 | |
| 4 | 2910 | 20.11.2024 | |
| 5 | 2939 | 22.06.2024 | |
| 5 | 4580 | 19.10.2024 | |
| 6 | 3020 | 15.07.2024 | |
| 6 | 1018 | 25.10.2024 | |
| 6 | 3020 | 15.07.2024 | |
| 7 | 1846 | 02.03.2024 | |
| 8 | 1084 | 07.03.2024 | |
| 9 | 3750 | 11.09.2024 | |
| 10 | 4950 | 12.03.2024 | |
| 10 | 4950 | 12.03.2024 |
I also have a composite key with the following measure :
Solved! Go to Solution.
Hi,
If you want to count the duplicates, then you can use the below measures to achieve that.
First, create a measure to count total rows in the table:
@samratpbi Thank you, however the results are not exactly correct and it is due to the date column
It is not considering date in the key. Please advise. Thanks
Hi @Anonymous
Please correct me if I've misunderstood.
In my understanding, samratpbi's method should be correct. Only composite key matches exactly will be counted, in your screenshot the two rows don't match exactly because of the different dates, so Date “22.05.2024” has a duplicate count of 0, while Date “10.04.2024 has a duplicate count of 1, which should be a duplicate of the original data.
Based on the example data you provided, using samratpbi's method, the test results look correct.
The measures created are as follows:
CompositeKey = [ID] & " | " & [Code] & " | " & [Date]CountAllRows = COUNTROWS('Table')CountDistinctRows = DISTINCTCOUNTNOBLANK('Table'[CompositeKey])DuplicateRowsCount = [CountAllRows] - [CountDistinctRows]
Best Regards,
Jarvis Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi,
If you want to count the duplicates, then you can use the below measures to achieve that.
First, create a measure to count total rows in the table:
@samratpbi Thanks actually the COUNTROWS on composite keys does not work
Can you please help..Thanks
Hi, Countrows works on table, not column. Hence please provide the table name, it should return total count in that table.
If this helps to resolve your problem, then mark it as solution, thanks!
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 39 | |
| 37 | |
| 33 | |
| 32 | |
| 29 |
| User | Count |
|---|---|
| 133 | |
| 88 | |
| 85 | |
| 68 | |
| 64 |