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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
tsuarez
Regular Visitor

Power BI Dax - Distinct Count and Contains String

I am trying to create a measure in Power BI where I am counting the distinct rows of one column if another column contains certain text in a string and keep getting an error.  Any assistance would be helpful.

2 ACCEPTED SOLUTIONS

@tsuarez ,

try this measure,

Count of Task Name = 
CALCULATE(
    DISTINCTCOUNT('Table'[Task Name]),
    CONTAINSSTRING('Table'[Label],"Weekly"))

Thanks,

Arul





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

Proud to be a Super User!


LinkedIn


View solution in original post

Thank you, this was helpful.

View solution in original post

4 REPLIES 4
tsuarez
Regular Visitor

Hello,

 

Here is some sample data below.  The data is based on tasks activity and I want to count the unique Task Names when Labels column contains "Weekly".  I'm trying to determine the unique tasks names and what their freqnecies are.

 

Task NameLabel
Arkansas Children's Hospital - HCP SurveysQuarterly;HCP Surveys
Crouse Health - Future VisibilityWeekly;Future Visibility
Internal Delivery - Influenza Vaccination StatusWeekly;Credential Data
Crouse Health - Future VisibilityWeekly;Future Visibility

@tsuarez ,

try this measure,

Count of Task Name = 
CALCULATE(
    DISTINCTCOUNT('Table'[Task Name]),
    CONTAINSSTRING('Table'[Label],"Weekly"))

Thanks,

Arul





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

Proud to be a Super User!


LinkedIn


Thank you, this was helpful.

Arul
Super User
Super User

@tsuarez ,

Please provide some sample data and the expected output with high level explanation of your requirement.

Thanks,

Arul





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

Proud to be a Super User!


LinkedIn


Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.