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
Anonymous
Not applicable

Excluding a value from condition

I am trying to filter out records where the column Device_Name contains = "ESX" or "Appliance". I have this query:

 

IF(NOT(CONTAINS(TableName,Device_Name,"ESX||"Appliance")))

 

The problem is there are values under Device_Name such as Labesx which I don't want filtered out. I just want to filter out device names that just contain the word ESX separately such as (esx-111, esx-222, esxI, rather than being a part of a string such as labesx.

 

How do I accomplish this?

1 ACCEPTED SOLUTION
v-gizhi-msft
Community Support
Community Support

Hi,

 

According to your description, i advise using LEFT function.

I create a simple sample to test:

100.PNG

Then create a column to extract specified string like 'esx' or 'Appliance':

 

Column = IF(LEFT('Table'[Device_Name],3)="esx"||LEFT('Table'[Device_Name],9)="Appliance",1,0)

 

Apply a filter about this column to the visual, the result shows:

101.PNG

Hope this helps.

 

Best Regards,

Giotto Zhi

View solution in original post

3 REPLIES 3
v-gizhi-msft
Community Support
Community Support

Hi,

 

According to your description, i advise using LEFT function.

I create a simple sample to test:

100.PNG

Then create a column to extract specified string like 'esx' or 'Appliance':

 

Column = IF(LEFT('Table'[Device_Name],3)="esx"||LEFT('Table'[Device_Name],9)="Appliance",1,0)

 

Apply a filter about this column to the visual, the result shows:

101.PNG

Hope this helps.

 

Best Regards,

Giotto Zhi

Greg_Deckler
Super User
Super User

Try something like this:

 

Table 2 = 
  FILTER(
      'Table',
      SEARCH("ESX",[Name],1,-1) <> 1 &&
        SEARCH("Appliance",[Name],1,-1) <> 1
  )

 

PBIX attached.

 


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
JarroVGIT
Resident Rockstar
Resident Rockstar

Make it an AND statement:

 

IF(NOT(CONTAINS(TableName,Device_Name,"ESX")) && NOT(CONTAINS(TableName,Device_Name,"Appliance")), <value for true>, <value for false>)





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




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.