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
JCuoco
Regular Visitor

Distinct Count one column with Contained Strings from another

Team,

I would like to do a distinct count on a column (Total Encounters) but only count the encounters that also have the value of "No Show" in a separate column 

Thanks,

James 

1 ACCEPTED SOLUTION
VahidDM
Super User
Super User

Hi @JCuoco 

 

You need to use Calculation with filter:

 

If you want to filter the table to show the rows which have "No Show" in a seperate column:

Measure = 
Calculate(DISTINCTCOUNT(table[Total Encounters]),Filter(table,table[separate column]="No Show"))

If "No Show" is part of the values of data in seperate column, use @ValtteriN solution.

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

 

 

View solution in original post

3 REPLIES 3
VahidDM
Super User
Super User

Hi @JCuoco 

 

You need to use Calculation with filter:

 

If you want to filter the table to show the rows which have "No Show" in a seperate column:

Measure = 
Calculate(DISTINCTCOUNT(table[Total Encounters]),Filter(table,table[separate column]="No Show"))

If "No Show" is part of the values of data in seperate column, use @ValtteriN solution.

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

 

 

@VahidDM thank you! This is absolutely perfect! love it! i did the "LONG" way last night and got the same number, so i know it is correct! THANK YOU

ValtteriN
Super User
Super User

Hi,

Here is one way to do this:

ValtteriN_2-1641421615438.png

 


Dax:

Apples =

calculate(COUNT(Applecount[AppleCount]),ALL(Applecount)) //Calculate all fruits
-
CALCULATE(DISTINCTCOUNT(Applecount[AppleCount]),
iserror(SEARCH("Apple",Applecount[AppleCount])),ALL(Applecount[AppleCount])) //calculate NOT apples


End result:
ValtteriN_1-1641421566963.png

 

I hope this helps and if it does consider accepting this as a solution and giving the post a thumbs up!





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




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.