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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
slatka11
Helper I
Helper I

Return value of a column if another column is null/blank?

Hi there,

 

I have the below 3 columns all in the same table (call it TABLE_1) and I am looking to return the value of one column if the other is blank:

 

MonthProjected RateActual Rate

December

1.351.34
January1.35 
February1.35 

 

What I am looking to acheive is that if the value in the "Actual Rate" column is blank, return the value in the "Projected Rate" column.

 

Thanks for your help.

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

Write this calculated column formula

=if(isblank(Data[Actual rate]),Data[projected rate],Data[Actual rate])

See if this shorther calculated column formula works as well

=coalesce(Data[Actual rate],Data[projected rate])

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

7 REPLIES 7
slatka11
Helper I
Helper I

Thank you very much

You are welcome.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Ashish_Mathur
Super User
Super User

Hi,

Write this calculated column formula

=if(isblank(Data[Actual rate]),Data[projected rate],Data[Actual rate])

See if this shorther calculated column formula works as well

=coalesce(Data[Actual rate],Data[projected rate])

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

What if I have two columns that contain null values and I want the priority to be if either of the two columns have data return that value and if not, return 'NO KEY'

Example:

kjbox76_1-1728056954161.png

 



Hi,

I would do this in Power Query

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjQyNlHSUVKK1YlWAtKmZuYWYDZUHMKPBQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"US PRODUCT KEY" = _t, #"CAN PRODUCT KEY" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"US PRODUCT KEY", Int64.Type}, {"CAN PRODUCT KEY", Int64.Type}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each if [US PRODUCT KEY]=null and [CAN PRODUCT KEY]=null then "No Key" else List.FirstN(List.Select(Record.ToList(_), each _<>null),1)),
    #"Expanded Custom" = Table.ExpandListColumn(#"Added Custom", "Custom")
in
    #"Expanded Custom"

Hope this helps.

Ashish_Mathur_0-1728098731356.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi, 

 

What if I have to do same thing with both null and 0. I have both in my columns. 

 

Thank you, 

Umesh

Hi,

Share some data, explain the question and show the expected result.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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