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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
arb1782
Helper III
Helper III

Counting duplicates only once in measure(s)

Hi

 

I have some data where each row is an individual. The rows of data are all unique but multiple rows may hold information about the same individual. I want to setup a variety of measures such as demorgraphic characteristics where you can toggle including all rows of data or just the unique ones. Can anyone help me with the correct DAX calculation?

 

I've put some dummy data together. 

 

IDFirst nameSurnameDOBGenderDate of record creation
ID1AbeSimpson01/05/1980Male01/01/2020
ID2AbeSimpson01/05/1980Male02/01/2020
ID3MargeSimpson01/04/1990Female01/01/2020
ID4MargeSimpson01/04/1990Female02/01/2020
ID5HomerSimpson01/04/1990Male03/01/2020
ID6BartSimpson01/05/1980Male03/01/2020
ID7AbeSimpson01/10/1987Male03/01/2020

 

Thanks

arb

1 ACCEPTED SOLUTION
v-juanli-msft
Community Support
Community Support

Hi @arb1782 

add columns

Column =
RANKX (
    FILTER (
        'Table',
        'Table'[First name] = EARLIER ( 'Table'[First name] )
            && 'Table'[Surname] = EARLIER ( 'Table'[Surname] )
            && 'Table'[DOB] = EARLIER ( 'Table'[DOB] )
            && 'Table'[Gender] = EARLIER ( 'Table'[Gender] )
    ),
    [Date of record creation],
    ,
    ASC,
    DENSE
)


Column 2 = IF([Column]=1,"Unique","Repeat")

Capture2.JPG

Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
v-juanli-msft
Community Support
Community Support

Hi @arb1782 

add columns

Column =
RANKX (
    FILTER (
        'Table',
        'Table'[First name] = EARLIER ( 'Table'[First name] )
            && 'Table'[Surname] = EARLIER ( 'Table'[Surname] )
            && 'Table'[DOB] = EARLIER ( 'Table'[DOB] )
            && 'Table'[Gender] = EARLIER ( 'Table'[Gender] )
    ),
    [Date of record creation],
    ,
    ASC,
    DENSE
)


Column 2 = IF([Column]=1,"Unique","Repeat")

Capture2.JPG

Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks Maggie

Mariusz
Community Champion
Community Champion

Hi @arb1782 

 

Sure, so can you give some examples of the expected outcomes based on the sample?

 

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn

 

Sure, something like the column at the end

 

IDFirst nameSurnameDOBGenderDate of record creationUnique or repeat individual?
ID1AbeSimpson01/05/1980Male01/01/2020Unique
ID2AbeSimpson01/05/1980Male02/01/2020Repeat
ID3MargeSimpson01/04/1990Female01/01/2020Unique
ID4MargeSimpson01/04/1990Female02/01/2020Repeat
ID5HomerSimpson01/04/1990Male03/01/2020Unique
ID6BartSimpson01/05/1980Male03/01/2020Unique
ID7AbeSimpson01/10/1987Male03/01/2020Unique

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.