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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
jonnyA
Responsive Resident
Responsive Resident

Formula for more than 1 patient

A client asked if I could create a report that showed the # of duplicate patients.  I'm not sure how to create that formula.  Any help is appreciated.

 

My dataset is Demo dataset.  And I assume I will have to use the Data Field Patient Name.

 

Thank you.

 

 

2 ACCEPTED SOLUTIONS
chonchar
Helper V
Helper V

Hi, I'm new here. I'll take a shot at this. 

 

If you just want the number, you can create a measure that counts rows (COUNTROWS) and another that counts distinct entries (DISTINCTCOUNT) in those rows. Then another measure that is (COUNTROWS) - (DISTINCTCOUNT) and that will populate the answer of dublicates. 

View solution in original post

Anonymous
Not applicable

Hi @jonnyA ,

 

@chonchar 's reply is a good idea. And you said you want a report showed them. You can create a measure as the visual-level filter for filtering.

Below is the sample for reference.

vstephenmsft_0-1692863439053.png

Based on your requirement, you need to show only patient A and patient B in the table visual.

The solution is to create a measure.

Measure = var _dis=CALCULATE(DISTINCTCOUNT('Table'[patient]),FILTER(ALLSELECTED('Table'),[patient]=MAX('Table'[patient])))
var _cou=CALCULATE(COUNT('Table'[patient]),FILTER(ALLSELECTED('Table'),[patient]=MAX('Table'[patient])))
return IF(_cou<>_dis,1)

Put the measure into the visual-level filters and set up show items when the value is 1. Below is the result.

41.png

 

                                                                                                                                                         

Best Regards,

Stephen Tao

 

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

2 REPLIES 2
Anonymous
Not applicable

Hi @jonnyA ,

 

@chonchar 's reply is a good idea. And you said you want a report showed them. You can create a measure as the visual-level filter for filtering.

Below is the sample for reference.

vstephenmsft_0-1692863439053.png

Based on your requirement, you need to show only patient A and patient B in the table visual.

The solution is to create a measure.

Measure = var _dis=CALCULATE(DISTINCTCOUNT('Table'[patient]),FILTER(ALLSELECTED('Table'),[patient]=MAX('Table'[patient])))
var _cou=CALCULATE(COUNT('Table'[patient]),FILTER(ALLSELECTED('Table'),[patient]=MAX('Table'[patient])))
return IF(_cou<>_dis,1)

Put the measure into the visual-level filters and set up show items when the value is 1. Below is the result.

41.png

 

                                                                                                                                                         

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.           

chonchar
Helper V
Helper V

Hi, I'm new here. I'll take a shot at this. 

 

If you just want the number, you can create a measure that counts rows (COUNTROWS) and another that counts distinct entries (DISTINCTCOUNT) in those rows. Then another measure that is (COUNTROWS) - (DISTINCTCOUNT) and that will populate the answer of dublicates. 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! It's time to submit your entry.

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.