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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Checking multiple columns for value, ignoring null

Hello,

 

I am trying to replace the values of a column from the values of another column (if not null).  I have 3 columns [Zip Code], [Zip Code.1], and [ZipCode] -- no row has null across for the 3 values. I want to get 1 column [NewPostal]. I am testing this first by creating a conditional column then will put that formula into the Replace.Values so i can replace the null values in the [Zip Code] column

 

My Test for the new column = Table.AddColumn(#"Expanded Zip Code to MSA", "NewPostal", each if [Zip Code] = null then [Zip Code.1] else if [Zip Code.1] = null then [ZipCode] else if [ZipCode] = null then [Zip Code] else [Zip Code])

 

Here i filtered to where [NewPostal] = null and you can see [ZipCode] has a value/not null

cesarvaldez_0-1663001303834.png

 

1 ACCEPTED SOLUTION
mahoneypat
Microsoft Employee
Microsoft Employee

The first part of the if is probably the problem. If Zip Code and Zip Code.1 are both null, you will get null. You can use the Coalesce syntax to get your desired result by updating the each part with the below syntax

 

each [Zip Code] ?? [Zip Code.1] ?? [ZipCode]

 

It will return the first non-null value.

 

Pat

 

 

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

1 REPLY 1
mahoneypat
Microsoft Employee
Microsoft Employee

The first part of the if is probably the problem. If Zip Code and Zip Code.1 are both null, you will get null. You can use the Coalesce syntax to get your desired result by updating the each part with the below syntax

 

each [Zip Code] ?? [Zip Code.1] ?? [ZipCode]

 

It will return the first non-null value.

 

Pat

 

 

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.