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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
alicia57
Helper I
Helper I

Filter on a word not following by letters

Hi,

 

I have a question concerning filters on a character string.

 

For example, a table with one column contains the following values:

/cart-all

/cart

/carton-/cart

/carte-

/cart?

 

I would like to have only rows with the word"cart" , i.e:

/cart-all

/cart

/carton-/cart

/cart?

 

I was looking for information about the function "search" but I do not know if this function is sufficient.

 

Thank you in advance for your help.
Alicia

2 ACCEPTED SOLUTIONS

Hello,

 

I have another idea to keep text strings with the word "cart" (and not "carte" or "carton"). As the word "card" have to be not followed by letters, I would like to test if the following characters are special characters or not, using the DAX function CODE().

But when I try it in Power BI with the simple example "Column2=CODE("A")", I have the error message "Failed to resolve name 'CODE'. It is not a valid table, variable or function name".

 

Would you have an idea of my mistake ?

 

Thank you very much,

Alicia

 

 

View solution in original post

Hi @alicia57,

 

You should use UNICODE function instead of CODE function in Power BI Desktop.Smiley Happy

Column2 = UNICODE("A")

 

Regards

View solution in original post

5 REPLIES 5
v-ljerr-msft
Microsoft Employee
Microsoft Employee

Hi @alicia57,

 

According to your description above, I would suggest you to try using the custom visual Attribute Slicer from Power BI Visual Gallery. Could you go to check if it works in your scenario?Smiley Happy

 

as1.PNG

 

Regards

Hi,

 

Thank you all for your answer.

 

I have tried to use the custom visual Attribute Slicer but it does not give the expected result.

 

This custom visual keeps all expressions containing the text string "cart" but I only want to keep the word "cart", following by nothing or only by special characters.

 

Regards,

Alicia

Hello,

 

I have another idea to keep text strings with the word "cart" (and not "carte" or "carton"). As the word "card" have to be not followed by letters, I would like to test if the following characters are special characters or not, using the DAX function CODE().

But when I try it in Power BI with the simple example "Column2=CODE("A")", I have the error message "Failed to resolve name 'CODE'. It is not a valid table, variable or function name".

 

Would you have an idea of my mistake ?

 

Thank you very much,

Alicia

 

 

Hi @alicia57,

 

You should use UNICODE function instead of CODE function in Power BI Desktop.Smiley Happy

Column2 = UNICODE("A")

 

Regards

Greg_Deckler
Super User
Super User

I don't think that the DAX SEARCH function will get you there, you seem to need regular expression parsing. If you can accomplish what you are trying to do in your query, you might have better luck in M (query editor). Although it does not have regular expression parsing either.



Follow on LinkedIn
@ 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!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.