Replace NULL values to another value in table - Power BI

Hi,

I want to replace all the cells that contain “null” to “unspecified” in my table. I followed an instructional video in creating a new column in query editor and replace “null” with “unspecified”, but the new column still has “null”. I used the query below:

if 'Incidents' [Province] = null then "Unspecified" else 'Incidents' [Province]

I don’t know what I’m missing here. Can anyone help?

Hi,

Oddly I could reproduce similar behaviour. It turned out that if, in my source data, the field is blank instead of showing null, I can replace as expected. I tried several other options, but it would seem that null as such is not the same as null in the query editor.

Paul

Enterprise%20DNA%20Expert%20-%20Small

Have a go using the technique below

You can try either one of the following:

  1. Create a new calculated column using DAX:

Column = if ( isblank( 'Incidents' [Province]), "Unspecifed" , 'Incidents' [Province])

  1. In Power Query, you can use:

= Table.TransformColumns(Source, {"Province", each if _ is null then "unspecified" else _})

  1. Use the “Replace Values” option in the Query Editor.

See if this helps you at all

Thanks
Sam

Thanks to the contributors of this post. Due to the length by which this post has been active, we are tagging it as Solved. For further questions related to this post, please make a new thread.