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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
PowerAppsUser
Frequent Visitor

Replace Values not working

Hi,

I am trying to replace the value of a cell with another value in Power Query by right clicking that cell and using 'Replace Value', but it doesnt seem to work. I want to change "null" to "Electricity". The function bar is showing the following function :

= Table.ReplaceValue(#"Trimmed Text",null,"Electricity",Replacer.ReplaceValue,{"Sector"})

But the cell value is not changing. Please let me know if anyone knows how to fix it.

Thanks!

1 ACCEPTED SOLUTION

Ah, it sounds like you had the text "null" rather than actual nulls. I didn't pick that up upon the first read.

 

In that case, you can skip the uppercase transformation and just use "null" instead of null in your original M code (insert the quotes into the formula):

= Table.ReplaceValue(#"Trimmed Text","null","Electricity",Replacer.ReplaceValue,{"Sector"})

 

View solution in original post

6 REPLIES 6
PowerAppsUser
Frequent Visitor

Thank you Samarth and Alexis for your help, I tried out both of your suggesions but somehow they dint work. So I tried another work around that finally worked - I changed the case of the column to UPPERCASE and made null as NULL, and then when I tried to change it with 'Replace Value', I was able to change it to Electricity. Then I went back and removed the UPPERCASE.

Ah, it sounds like you had the text "null" rather than actual nulls. I didn't pick that up upon the first read.

 

In that case, you can skip the uppercase transformation and just use "null" instead of null in your original M code (insert the quotes into the formula):

= Table.ReplaceValue(#"Trimmed Text","null","Electricity",Replacer.ReplaceValue,{"Sector"})

 

Your right! I tried your code with "null" and it worked! But I still wonder why the 'Replace Values' dint work.

 

Thank you, Alexis!

It's a bit of an odd situation. If "null" gets interpreted as text (as in your case) then what would you put into the box to indicate an actual null value (where there's nothing in the cell)? It appears that Microsoft decided to interpret someone typing in null as the latter rather than the former (probably because that situation is a bit more common). Both interpretations will get it wrong some of the time.

AlexisOlson
Super User
Super User

It might be an empty string "" instead of a null. See if this works:

 

= Table.ReplaceValue(#"Trimmed Text","","Electricity",Replacer.ReplaceValue,{"Sector"})

Or as @Samarth_18 suggests, it might be a space or some other type of whitespace.

 

Samarth_18
Community Champion
Community Champion

Hi @PowerAppsUser ,

 

Try with putting single space inside the "Value to find" section.

Samarth_18_0-1648664865445.png

 

Thanks,

Samarth

 

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors