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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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