Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
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!
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 56 | |
| 47 | |
| 44 | |
| 20 | |
| 20 |
| User | Count |
|---|---|
| 73 | |
| 72 | |
| 34 | |
| 33 | |
| 31 |