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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Blizzard
Regular Visitor

Count duplicates only once in a column

Hi all,

 

I want to identify in a column (not as a measure) all values for a specific ID only once. 

 

IDDateUnique
1009.11.2017YES
201.12.2017YES
1011.11.2011NO

 

The respective formular in Excel works fine as follows:

 

=IF(MATCH(A4,A:A,0)=ROW(),"YES","NO")

 

What I wanted to do is, that the last entry of an ID is identified as unique (column C) and all past values of the same ID should be marked as "no". Therefore the DISTINCTCOUNT formular with filter is not working. In that case, all double values would be counted > 1. For ID 10 the outcoume would be 2 for both rows but I want to count ID excatly one time as unique.

 

I dont want to delete duplicate rows.

 

Does anyone has an idea how to solve that problem?

 

Regards

Michael

1 ACCEPTED SOLUTION
Zubair_Muhammad
Community Champion
Community Champion

Hi @Blizzard

 

Please try this column

 

Column =
VAR IDCount =
    CALCULATE ( COUNTROWS ( Table1 ), ALLEXCEPT ( Table1, Table1[ID] ) ) = 1
VAR Last_Date =
    Table1[Date]
        = CALCULATE ( MAX ( Table1[Date] ), ALLEXCEPT ( Table1, Table1[ID] ) )
RETURN
    IF ( OR ( IDCount, Last_Date ), "Yes", "No" )

View solution in original post

2 REPLIES 2
Zubair_Muhammad
Community Champion
Community Champion

Hi @Blizzard

 

Please try this column

 

Column =
VAR IDCount =
    CALCULATE ( COUNTROWS ( Table1 ), ALLEXCEPT ( Table1, Table1[ID] ) ) = 1
VAR Last_Date =
    Table1[Date]
        = CALCULATE ( MAX ( Table1[Date] ), ALLEXCEPT ( Table1, Table1[ID] ) )
RETURN
    IF ( OR ( IDCount, Last_Date ), "Yes", "No" )

Hi @Zubair_Muhammad,

 

your code is working as well. For the first step I used the code presented here.

 

Unfortunately I double posted my question :(. But as your formular is working as well, I`m confident that I can use it for the next step in another calcualtion.

 

Thanks a lot,

 

Michael

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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