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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
tsuarez
New Member

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
New Member

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.