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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Bleucherie
New Member

Replace spaces with an asterisk in Power Query

Hello,

I am looking to find a way to find and replace spaces in a cell with an asterisk so that I can run the rest of the Power Query steps of my template. From the below image I am looking to add a step where if there is a "Remark=" text in the Remarks 10 column it would replace the spaces in between the text/numbers to asterisks as noted in the Expected Result column. I was looking at the Find and Replace function but since the Remarks 10 column can include other descriptions it is not going to work well. Thanks!

 

Replace spaces.jpg

 

 

1 ACCEPTED SOLUTION
ronrsnfld
Super User
Super User

You can use the Table.ReplaceValue function. Replace #"Previous Step" with the Obvious

#"Remark Asterisk"=Table.ReplaceValue(
        #"Previous Step",
        each [Remarks 10],
        null,
        (x,y,z) as text=> if Text.StartsWith(y,"REMARK=") then Text.Replace(x," ","*") else x,
        {"Remarks 10"})

 

View solution in original post

3 REPLIES 3
ronrsnfld
Super User
Super User

You can use the Table.ReplaceValue function. Replace #"Previous Step" with the Obvious

#"Remark Asterisk"=Table.ReplaceValue(
        #"Previous Step",
        each [Remarks 10],
        null,
        (x,y,z) as text=> if Text.StartsWith(y,"REMARK=") then Text.Replace(x," ","*") else x,
        {"Remarks 10"})

 

Thank you this worked perfectly!

ToddChitt
Super User
Super User

You should be able to use the Power Query step of "Replace Values..." if you right click on the column.

ToddChitt_0-1748626460459.png

 

ToddChitt_1-1748626482051.png

 

You can't see it, but there is a space character in the Value to find field above.

Result:

ToddChitt_2-1748626523526.png

 

 




Did I answer your question? If so, mark my post as a solution. Also consider helping someone else in the forums!

Proud to be a Super User!





Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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

Top Solution Authors