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

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
actzikas
Frequent Visitor

Contains Operator in a Measure

Is there a way you can use a contains like operator in a measure? 


What I am trying to do here is filter all activity types that CONTAINS "Call" 

 

Number of Calls = CALCULATE(Count('Renewal Activity (Offsite Data)'[Activity Type]), FILTER('Renewal Activity (Offsite Data)', 'Renewal Activity (Offsite Data)'[Activity Type] CONTAINS "Call" ))
1 ACCEPTED SOLUTION
v-kelly-msft
Community Support
Community Support

Hi @actzikas

 

First you need to create a calculated column to check whether the selected line has the value you need:

 

Column = CONTAINSSTRING('Renewal Activity (Offsite Data)'[Activity Type],"Call")

Then you can calculate the numbers of calls using a measure:

Measure = CALCULATE(COUNTROWS(Renewal Activity (Offsite Data)),'Renewal Activity (Offsite Data)'[Column]=True())

 

Finally it will show similarly to my sample data as below:

1121.png1122.png

 

 

Best Regards,

Kelly

 

 

 

 

View solution in original post

4 REPLIES 4
Tahreem24
Super User
Super User

@actzikas 

 Create 2 fields to accomplish your requirement:

Calculated Column = SEARCH("Call",'Renewal Activity'[Activity Type],1,0)

Measure = CALCULATE(COUNT('Renewal Activity'[Offsite Data]),[Calcualted Column],'Renewal Activity'[Activity Type])

 

I have created sample for

Capture.JPG

 

Please don't forget to hit THUMBS UP and Accept this as a solution if it helps you!

 

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Please take a quick glance at newly created dashboards : Restaurant Management Dashboard , HR Analytics Report , Hotel Management Report, Sales Analysis Report , Fortune 500 Companies Analysis , Revenue Tracking Dashboard
v-kelly-msft
Community Support
Community Support

Hi @actzikas

 

First you need to create a calculated column to check whether the selected line has the value you need:

 

Column = CONTAINSSTRING('Renewal Activity (Offsite Data)'[Activity Type],"Call")

Then you can calculate the numbers of calls using a measure:

Measure = CALCULATE(COUNTROWS(Renewal Activity (Offsite Data)),'Renewal Activity (Offsite Data)'[Column]=True())

 

Finally it will show similarly to my sample data as below:

1121.png1122.png

 

 

Best Regards,

Kelly

 

 

 

 

Tahreem24
Super User
Super User

You can use contains dax function and syntax is given below:
CONTAINS(<table>, <columnName>, <value>[, <columnName>, <value>]…)

https://docs.microsoft.com/en-us/dax/contains-function-dax

Don't forget to give thumbs up 👍and accept this as a solution if this helps you.
Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Please take a quick glance at newly created dashboards : Restaurant Management Dashboard , HR Analytics Report , Hotel Management Report, Sales Analysis Report , Fortune 500 Companies Analysis , Revenue Tracking Dashboard

Yes, I saw that article but how would you use it in the above example I created?

 

I tried 

 

Number of Calls = CALCULATE(Count('Renewal Activity (Offsite Data)'[Activity Type]), Contains('Renewal Activity (Offsite Data)', 'Renewal Activity (Offsite Data)'[Activity Type] = "Call" ))

 

And that didn't work @Tahreem24 

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.