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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
ShaneL79
Helper I
Helper I

Contains Partial Text

This is probably a dumb question, but I want to countrows where "blue" is contained within the column. 
 
The column typically has several results that look like this "Red >> Blue >> Orange"
 
I know equals is "=", and does not equal is "<>", but what is contains? 
 
Here is the sample of my code, which structure I would like to maintain for the sake of my beginner knowledge.
 
 
Assessments =

 

CALCULATE (
COUNTROWS (Alarms),
Alarms[Assessments Employee] = " Blue ",
1 ACCEPTED SOLUTION
v-kelly-msft
Community Support
Community Support

Hi @ShaneL79

 

You can also use "find" or "seach",such as:

 

Assessments=
var a =search("blue",SELECTEDVALUE('Alarms'[Assessments Employee]),,0)
Return
IF(a<>0,COUNTROWS('Alarms'),BLANK())

 

 

Best Regards,
Kelly
 
Did I answer your question? Mark my post as a solution!

View solution in original post

2 REPLIES 2
v-kelly-msft
Community Support
Community Support

Hi @ShaneL79

 

You can also use "find" or "seach",such as:

 

Assessments=
var a =search("blue",SELECTEDVALUE('Alarms'[Assessments Employee]),,0)
Return
IF(a<>0,COUNTROWS('Alarms'),BLANK())

 

 

Best Regards,
Kelly
 
Did I answer your question? Mark my post as a solution!
ImkeF
Community Champion
Community Champion

Hi @ShaneL79 

the CONTAINSSTRING-function should do this job: https://docs.microsoft.com/en-us/dax/containsstring-function-dax

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.