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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
leibowjb
Frequent Visitor

Counting duplicat values

I have a dataset related to automotive service data. The dataset has 165K rows which is the total number of repair orders that came into the shop.

 

I need to calculate two measures:

  1. Unique: The unique # of vins that came into the store which I can obtain by using distinctcount
  2. 2+ Visits: The count of vins that came in 2+ times

If I have the above two counts, I can then divide the ‘2+ visits’ number by ‘unique’ to obtain the % of unique vins that have come into the shop more than once.

I am having trouble figuring out a dax formula for #2 above – essentially, counting values where the value shows up more than once (is duplicated).

2 ACCEPTED SOLUTIONS
v-sihou-msft
Microsoft Employee
Microsoft Employee

@leibowjb

 

In this scenario, you can create a variable to get th count of visits for each user. 

 

=CALCULATE(COUNTA(Table[VisitDate]),ALLEXCEPT(Table,Table[User]))

Then you can create a measure to filter users with more than 2 visits. 

 

 

2 plus visits users =
VAR CountOfVisits =
    CALCULATE ( COUNTA ( Table[VisitDate] ), ALLEXCEPT ( Table, Table[User] ) )
RETURN
    CALCULATE (
        DISTINCTCOUNT ( Table[User] ),
        FILTER ( Table, CountOfVisits >= 2 )
    )

Regards,

View solution in original post

In the CALCULATE  you can add another FILTER => ALLSELECTED([Dates]

View solution in original post

3 REPLIES 3
v-sihou-msft
Microsoft Employee
Microsoft Employee

@leibowjb

 

In this scenario, you can create a variable to get th count of visits for each user. 

 

=CALCULATE(COUNTA(Table[VisitDate]),ALLEXCEPT(Table,Table[User]))

Then you can create a measure to filter users with more than 2 visits. 

 

 

2 plus visits users =
VAR CountOfVisits =
    CALCULATE ( COUNTA ( Table[VisitDate] ), ALLEXCEPT ( Table, Table[User] ) )
RETURN
    CALCULATE (
        DISTINCTCOUNT ( Table[User] ),
        FILTER ( Table, CountOfVisits >= 2 )
    )

Regards,

Thank you so much! This works except for when I put a slicer on my dashboard and filter for a specific date range. Any suggestions? Essentially, when I filter for certain open date ranges, I want my formulas to recalculate based on my specified date range. Thanks again for all the help.

 

CountofVisits = CALCULATE(COUNTA(Table[Open Date]),ALLEXCEPT(Table,Table[VIN]))

 

Count2+ = CALCULATE(DISTINCTCOUNT(Table[VIN]),FILTER(Table,[CountofVisits]>=2))

In the CALCULATE  you can add another FILTER => ALLSELECTED([Dates]

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.