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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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")) ) )

 

View solution in original post

2 REPLIES 2
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")) ) )

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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