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
jytech
Helper I
Helper I

Find value and replace entire column with custom values

Hello,

 

I would like to search for a single text string in a cell that contains a long URL and replace that entire URL with a custom value/string.

 

For example this URL: /Login?ReturnUrl=https://www.company.org/support/articles-and-how-tos/10-steps-for-planning-a-successful-webinar. I would like to search the entire table for URL's containing the text string "articles" then replace that cell with the word "articles" only. The cells that do not contain "articles" to be replaced with "none." How can I do this?

 

Also, this URL: /posts/how-can-cloud-storage-benefit-my-company-http://blog.company.org/posts/how-can-cloud-storage-benefit-my-company, I would like to search the entire table for URL's containing the text string "blog" then replace that cell with the word "blog" only.

 

 

1 ACCEPTED SOLUTION

Hi,

You may download the PBI file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

6 REPLIES 6
Ashish_Mathur
Super User
Super User

Hi,

In a calculated column formula, you may use the IF() and SEARCH() functions.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

@Ashish_Mathur can you please provide an example of what that formula would look like?

Hi,

You may download the PBI file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

@Ashish_Mathur it worked perfectly. Thank you very much!

You are welcome.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
lbendlin
Super User
Super User

Check the documentation

https://docs.microsoft.com/en-us/powerquery-m/table-replacevalue

 

You will notice that the replacer is a function. This means you can use whatever custom function you want in that step, including the checks that you describe.  You could even have a reference table with keywords that should be searched for, and that should replace the entire cell contents if found.

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.