Forum Discussion
Find out duplicate values from composite key
- 4 years ago
Hi Anonymous ,
According to your description, I create a sample.
In the sample, the count of all duplicates is 5, the count of distinct customer ID in the duplicates is 2, here's my solution.
Create two measures.
ALL Dup = COUNTROWS ( FILTER ( ALL ( 'Table' ), COUNTROWS ( FILTER ( ALL ( 'Table' ), 'Table'[Customer ID] = EARLIER ( 'Table'[Customer ID] ) && 'Table'[Region] = EARLIER ( 'Table'[Region] ) ) ) > 1 ) )Count Dup ID = CALCULATE ( DISTINCTCOUNT ( 'Table'[Customer ID] ), FILTER ( ALL ( 'Table' ), COUNTROWS ( FILTER ( ALL ( 'Table' ), 'Table'[Customer ID] = EARLIER ( 'Table'[Customer ID] ) && 'Table'[Region] = EARLIER ( 'Table'[Region] ) ) ) > 1 ) )Get the correct result.
I attach my sample below for reference.
Best Regards,
Community Support Team _ kalyjIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Anonymous ,
According to your description, I create a sample.
In the sample, the count of all duplicates is 5, the count of distinct customer ID in the duplicates is 2, here's my solution.
Create two measures.
ALL Dup =
COUNTROWS (
FILTER (
ALL ( 'Table' ),
COUNTROWS (
FILTER (
ALL ( 'Table' ),
'Table'[Customer ID] = EARLIER ( 'Table'[Customer ID] )
&& 'Table'[Region] = EARLIER ( 'Table'[Region] )
)
) > 1
)
)
Count Dup ID =
CALCULATE (
DISTINCTCOUNT ( 'Table'[Customer ID] ),
FILTER (
ALL ( 'Table' ),
COUNTROWS (
FILTER (
ALL ( 'Table' ),
'Table'[Customer ID] = EARLIER ( 'Table'[Customer ID] )
&& 'Table'[Region] = EARLIER ( 'Table'[Region] )
)
) > 1
)
)
Get the correct result.
I attach my sample below for reference.
Best Regards,
Community Support Team _ kalyj
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.