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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Anonymous
Not applicable

DAX: Count the number of values that appear more than once in a column

Hi,

 

Suppose I have a list of people, along with the dates that they accessed a venue, as below.

PersonDate of Access
Alice1/01/2022
Alice2/01/2022
Alice10/01/2022
Bob4/01/2022
Carol8/01/2022
Dave6/01/2022
Eva4/01/2022
Eva8/01/2022
Eva9/01/2022
Eva10/01/2022
Eva11/01/2022
Eva12/01/2022
Eva22/01/2022

I'd like to count the number of people who accessed the venue more than once. Based on the data above, the answer should be 2 (Alice and Eva). 

How do you make this calculation using DAX?

 

Thanks!

1 ACCEPTED SOLUTION
ebeery
Memorable Member
Memorable Member

@Anonymous there are probably more consise ways to accomplish, but I find it helpful to do such calculations in steps so that so that I can better visualize what's happening.

Here's one way:

Count Duplicates = 
VAR _CountbyPerson =
    ADDCOLUMNS (
        SUMMARIZE ( 'Table', 'Table'[Person] ),
        "@Count", CALCULATE ( DISTINCTCOUNT ( 'Table'[Date of Access] ) )
    )
VAR _GreaterThan1 =
    FILTER ( _CountbyPerson, [@Count] > 1 )
VAR _Result =
    COUNTROWS ( _GreaterThan1 )
RETURN
    _Result

 

ebeery_0-1646360368211.png

 

View solution in original post

3 REPLIES 3
ebeery
Memorable Member
Memorable Member

@Anonymous there are probably more consise ways to accomplish, but I find it helpful to do such calculations in steps so that so that I can better visualize what's happening.

Here's one way:

Count Duplicates = 
VAR _CountbyPerson =
    ADDCOLUMNS (
        SUMMARIZE ( 'Table', 'Table'[Person] ),
        "@Count", CALCULATE ( DISTINCTCOUNT ( 'Table'[Date of Access] ) )
    )
VAR _GreaterThan1 =
    FILTER ( _CountbyPerson, [@Count] > 1 )
VAR _Result =
    COUNTROWS ( _GreaterThan1 )
RETURN
    _Result

 

ebeery_0-1646360368211.png

 

Hello,

Found this solution useful fro one of my task in 2024 here.. I wanted to add a small condition to the above question where the Date of Access should be less than of equal to today. Could you please help?

Anonymous
Not applicable

Thank you very much, @ebeery. The way you laid it out makes it easy for novices like me to follow your logic too!

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Kudoed Authors