cancel
Showing results for 
Search instead for 
Did you mean: 
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

If I answered your question then mark my post as a solution and a kudo would be appreciated.

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

If I answered your question then mark my post as a solution and a kudo would be appreciated.

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

If I answered your question then mark my post as a solution and a kudo would be appreciated.

Helpful resources

Announcements
May 2023 update

Power BI May 2023 Update

Find out more about the May 2023 update.

Submit your Data Story

Data Stories Gallery

Share your Data Story with the Community in the Data Stories Gallery.

Top Solution Authors