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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register 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!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

December 2024

A Year in Review - December 2024

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