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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
brockry1
Helper II
Helper II

Contains vs Equals

I have this measure to bring back the toatal traings from the subject column in the events and Tasks table.  I want it to show "Contains" vs equals at the end but im getting an error when trying.  How do I adjsut to get contains  trainings in the subject column? 
 
# of completed events_Trainings = CALCULATE(DISTINCTCOUNT('Event & Task'[ID]),'Event & Task'[Status (Consolidated)]="Completed", 'Event & Task'[Subject] = "Training")
1 ACCEPTED SOLUTION
quantumudit
Super User
Super User

Hello @brockry1 

You can use the following DAX formula instead if you want to determine whether the Subject column contains the "Training" string or not:

 

 

# of completed events_Trainings =
CALCULATE (
    DISTINCTCOUNT ( 'Event & Task'[ID] ),
    'Event & Task'[Status (Consolidated)] = "Completed",
    CONTAINSSTRING ( 'Event & Task'[Subject], "Training" ) = TRUE
)

 

 

The CONTAINSSTRING() function is case-insensitive. However, if you require a strictly case-sensitive check, use CONTAINSSTRINGEXACT() instead.

 

You can learn more about these functions here:

I have created small dataset of only 10 rows verify the, and here is the screenshot of it

quantumudit_0-1739684629431.png

I am also attaching the sample Power BI file for your reference.

 

Best Regards,
Udit

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudo 👍

🚀 Let's Connect: LinkedIn || YouTube || Medium || GitHub
Visit My Linktree: LinkTree

Proud to be a Super User

View solution in original post

1 REPLY 1
quantumudit
Super User
Super User

Hello @brockry1 

You can use the following DAX formula instead if you want to determine whether the Subject column contains the "Training" string or not:

 

 

# of completed events_Trainings =
CALCULATE (
    DISTINCTCOUNT ( 'Event & Task'[ID] ),
    'Event & Task'[Status (Consolidated)] = "Completed",
    CONTAINSSTRING ( 'Event & Task'[Subject], "Training" ) = TRUE
)

 

 

The CONTAINSSTRING() function is case-insensitive. However, if you require a strictly case-sensitive check, use CONTAINSSTRINGEXACT() instead.

 

You can learn more about these functions here:

I have created small dataset of only 10 rows verify the, and here is the screenshot of it

quantumudit_0-1739684629431.png

I am also attaching the sample Power BI file for your reference.

 

Best Regards,
Udit

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudo 👍

🚀 Let's Connect: LinkedIn || YouTube || Medium || GitHub
Visit My Linktree: LinkTree

Proud to be a Super User

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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