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

Try your skills in the Power BI Dataviz World Championship! Round one ends June 26. Join now

Reply
warnera
Helper I
Helper I

Distinct total based on another column

Hello, I have a data set like this. I am trying to get a distinct count of the medication per MRN. The medication may repeat for the MRN but I would only like to count it once.

 

MRN    Medication

0001    Drug A

0001    Drug A

0001    Drug B

0002    Drug C

0002    Drug A

0003    Drug B

0003    Drug B

 

I need the data to look like this

 

Drug A - 2

Drug B - 2

Drug C -1

1 ACCEPTED SOLUTION
harshnathani
Community Champion
Community Champion

Hi @warnera ,

 

Apart from Solution mentioned abovem you can try

 

Count = CountROWS(SUMMARIZE('Table','Table'[Medication],'Table'[MRN ]))
 
1.jpg

 

Regards,
Harsh Nathani

Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

View solution in original post

3 REPLIES 3
rubinboer
Resolver II
Resolver II

a normal table can visualize the data as it is, should you not need the count in other calculations. Add a table to the canvas drop the Medicine column in it first and then add th distinct count of the MRN. rename the Count of MRN to MRN. a quick ways if all you want is the visualization.

harshnathani
Community Champion
Community Champion

Hi @warnera ,

 

Apart from Solution mentioned abovem you can try

 

Count = CountROWS(SUMMARIZE('Table','Table'[Medication],'Table'[MRN ]))
 
1.jpg

 

Regards,
Harsh Nathani

Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

amitchandak
Super User
Super User

@warnera , you need to use

distinctcount(Table[MRN]) and view it by Medication

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Fabric Data Days is here Carousel

Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.