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
Anonymous
Not applicable

Replacing values of null and blank do not work as expected in Power Query

Hello Power Query Champions,

 

I am struggling to replace blank and null values in my table using Power Query.

This is the code that I have used referring various blogs:

 

Custom1 = Table.ReplaceValue(#"Replaced Value18",each [Landing Page.1],each if [Landing Page.1]= null then "a" else if [Landing Page.1] = " " then "P" else [Landing Page.1],Replacer.ReplaceText,{"Landing Page.1"})

 

However nothing happens.

Is there anything that I am doing wrong here?

 

The text I am trying to replace is in Text format

1 ACCEPTED SOLUTION
Vera_33
Resident Rockstar
Resident Rockstar

Hi @Anonymous 

 

Please have a try

 Custom1 = Table.TransformColumns( #"Replaced Value18",{"Landing Page.1", each if _=null then "a" else if _=" " then "P" else _})

 

View solution in original post

4 REPLIES 4
Vera_33
Resident Rockstar
Resident Rockstar

Hi @Anonymous 

 

Please have a try

 Custom1 = Table.TransformColumns( #"Replaced Value18",{"Landing Page.1", each if _=null then "a" else if _=" " then "P" else _})

 

Anonymous
Not applicable

Hi Vera,

 

It's working fine for the string however it's not working in case I wanat to pass the field name.

Hi Nikhil,

 

So what do you want to do with the column "Landing Page.1"? I was modifying your original code.

Anonymous
Not applicable

Thanks Vera.I have achieved what I wanted.

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.

Top Solution Authors