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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Dunner2020
Post Prodigy
Post Prodigy

do not containsstring in DAX

Hi there,

 

I am creating a measure that filters the table based on the 'description' column.  I dont want to include the rows if certain keywords present in the description column. I used containsstring() function to exclude keywords.  I have created the measure with the following code:

 

text contains = COUNTROWS(FILTER('Interruptions',CONTAINSSTRING('Interruptions'[Description],"FAULTED, LV" ) = FALSE() &&
CONTAINSSTRING('Interruptions'[Description],"LV FUSE") = FALSE() &&
CONTAINSSTRING(Interruptions'[Description],"CABLE FAULTED") = FALSE() &&
CONTAINSSTRING('Interruptions'[Description],"BLOWN LV") = FALSE() &&
CONTAINSSTRING('Interruptions'[Description],"BURNT CONNECTOR LV") = FALSE() &&
CONTAINSSTRING('Interruptions'[Description],"INTERMITTENT HIGH LOAD?") = FALSE() &&
CONTAINSSTRING('Interruptions'[Description],"LINE , LV") = FALSE() ) )

 

However, it does not filter. I am not sure where am I making the mistake? Is it the right way to use containstring() function to exvclude the keywords?

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Dunner2020 , see fine. Is it case sensitive search?

https://docs.microsoft.com/en-us/dax/search-function-dax is case insensitive 

You can rewrite like

COUNTROWS(FILTER('Interruptions',not(CONTAINSSTRING('Interruptions'[Description],"FAULTED, LV" ) ) &&
not(CONTAINSSTRING('Interruptions'[Description],"LV FUSE") ) &&
not(CONTAINSSTRING('Interruptions'[Description],"CABLE FAULTED")) &&
not(CONTAINSSTRING('Interruptions'[Description],"BLOWN LV")) &&
not(CONTAINSSTRING('Interruptions'[Description],"BURNT CONNECTOR LV") ) &&
not(CONTAINSSTRING('Interruptions'[Description],"INTERMITTENT HIGH LOAD?") ) &&
not(CONTAINSSTRING('Interruptions'[Description],"LINE , LV")) ) )

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

3 REPLIES 3
danielcassidy
Regular Visitor

Excellent, this worked for me too, thank you !

amitchandak
Super User
Super User

@Dunner2020 , see fine. Is it case sensitive search?

https://docs.microsoft.com/en-us/dax/search-function-dax is case insensitive 

You can rewrite like

COUNTROWS(FILTER('Interruptions',not(CONTAINSSTRING('Interruptions'[Description],"FAULTED, LV" ) ) &&
not(CONTAINSSTRING('Interruptions'[Description],"LV FUSE") ) &&
not(CONTAINSSTRING('Interruptions'[Description],"CABLE FAULTED")) &&
not(CONTAINSSTRING('Interruptions'[Description],"BLOWN LV")) &&
not(CONTAINSSTRING('Interruptions'[Description],"BURNT CONNECTOR LV") ) &&
not(CONTAINSSTRING('Interruptions'[Description],"INTERMITTENT HIGH LOAD?") ) &&
not(CONTAINSSTRING('Interruptions'[Description],"LINE , LV")) ) )

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

I an using NOT(CONTAINSSTRING('Email Message'[FromName],"do not reply")), but when I add that to my measure to filter, my email count goes up.  why would it go up if I am adding a NOT(CONTAINSSTRING(

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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