cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
pedroccamara Regular Visitor
Regular Visitor

How to search for a string of characters

Hello everyone

Is there a way of searching a person's name, for example, in the whole table and whole fields? How?

Best regards

Pedro

3 ACCEPTED SOLUTIONS

Accepted Solutions
Super User
Super User

Re: How to search for a string of characters

Yes, you can use Table.FindText: https://msdn.microsoft.com/en-us/library/mt260782.aspx

this will return the row where the text is found

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

Proud to be a Datanaut!

Imke Feldmann

How to integrate M-code into your solution -- Check out more PBI- learning resources here -- Performance Tipps for M-queries




Super User
Super User

Re: How to search for a string of characters

Sure. Check out this video and come back if there is anything else that can help:

https://youtu.be/QGhULCWvySM

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

Proud to be a Datanaut!

Imke Feldmann

How to integrate M-code into your solution -- Check out more PBI- learning resources here -- Performance Tipps for M-queries




v-ljerr-msft Super Contributor
Super Contributor

Re: How to search for a string of characters

Hi @pedroccamara,

 

In addition to ImkeF's solution, you can also use SEARCH Function (DAX) to create a calculate column within Modeling tab in this scenario. See my sample below.

 

Assume we have a table called "MyTestTable" like below.

t1.PNG

1. Use the formula below to create a calculate column called "NameContainsBob" in "MyTestTable".

NameContainsBob = IF ( ISERROR ( SEARCH ( "Bob", MyTestTable[Name] ) ), "Other", "Bob" )

cc1.PNG

2. Then you should be able to use "NameContainsBob" column as a Slicer and show the data you want in the report.

result.PNG

Here is the sample pbix file for your reference.

 

Regards

5 REPLIES 5
Super User
Super User

Re: How to search for a string of characters

Yes, you can use Table.FindText: https://msdn.microsoft.com/en-us/library/mt260782.aspx

this will return the row where the text is found

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

Proud to be a Datanaut!

Imke Feldmann

How to integrate M-code into your solution -- Check out more PBI- learning resources here -- Performance Tipps for M-queries




pedroccamara Regular Visitor
Regular Visitor

Re: How to search for a string of characters

Hello Imkef

Many thanks for your reply

 

Please can you be more specific?

 

Where can i use it and how? Is it in editor mode or...? Can i choose some kind of visualizations?

Can you help me please, cose it's a procedure that i'm doing too many times in a day...

 

Tks a lot

Best regards

Pedro

Super User
Super User

Re: How to search for a string of characters

Sure. Check out this video and come back if there is anything else that can help:

https://youtu.be/QGhULCWvySM

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

Proud to be a Datanaut!

Imke Feldmann

How to integrate M-code into your solution -- Check out more PBI- learning resources here -- Performance Tipps for M-queries




v-ljerr-msft Super Contributor
Super Contributor

Re: How to search for a string of characters

Hi @pedroccamara,

 

In addition to ImkeF's solution, you can also use SEARCH Function (DAX) to create a calculate column within Modeling tab in this scenario. See my sample below.

 

Assume we have a table called "MyTestTable" like below.

t1.PNG

1. Use the formula below to create a calculate column called "NameContainsBob" in "MyTestTable".

NameContainsBob = IF ( ISERROR ( SEARCH ( "Bob", MyTestTable[Name] ) ), "Other", "Bob" )

cc1.PNG

2. Then you should be able to use "NameContainsBob" column as a Slicer and show the data you want in the report.

result.PNG

Here is the sample pbix file for your reference.

 

Regards

pedroccamara Regular Visitor
Regular Visitor

Re: How to search for a string of characters

Hello ImkeF and JerryLi

 

I'm so lucky for this solution you've show me.

Gotta test them both monday. 

you're both awesome!

Tks a lot

Best regards

Pedro