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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
Anonymous
Not applicable

Help with IF multiple if statements

I have 4 columns with different values. I need a function that:

 

IF Column Value1 is empty, take Column Value2, and if this one is empty, take Column Value3, and if that one is empty, take Column Value4.

 

Can someone help me express this with IF statements or Switch?

 

Thank you!

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

Try this calculated column formula

=if(isblank(Data[Column1]),if(isblank(Data[Column2]),if(isblank(Data[Column3]),Data[Column4],Data[Column3]),Data[Column2]),Data[Column1])


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

View solution in original post

9 REPLIES 9
Candlewing2
New Member

This is perfect! Many thanks, Ashish! 🙂

You are welcome.


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

Hi,

Try this calculated column formula

=if(isblank(Data[Column1]),if(isblank(Data[Column2]),if(isblank(Data[Column3]),Data[Column4],Data[Column3]),Data[Column2]),Data[Column1])


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

Hi @Ashish_Mathur , I have the same problem but the formula is not working

 

I want to create a calculated column where

  • If Column 1 is blank get the date from
  • Column 2 but if this is blank get the dates from
  • Column 3 but if this is blank get the dates from
  • Column 4

    This is my data and the final dates is the Calculated column i want as outcome

 

Offer AcceptedOffer Accepted (On Boarding)Accepted forms reviewedForms completedAccepted Forms completed Pending ReviewFinal Dates
07/02/2022    07/02/2022
18/02/2022    18/02/2022
23/02/2022    23/02/2022
23/02/2022    23/02/2022
Blank11/03/2022   11/03/2022
Blank11/03/2022   11/03/2022
Blank11/03/2022   11/03/2022
BlankBlank11/05/2022  11/05/2022
BlankBlank11/05/2022  11/05/2022
BlankBlank11/05/2022  11/05/2022
BlankBlankBlank24/02/2022 24/02/2022
BlankBlankBlankBlank05/04/202205/04/2022
 

hi,

It is easier to solve this in the Query Editor.  This M code works

let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Offer Accepted", type date}, {"Offer Accepted (On Boarding)", type date}, {"Accepted forms reviewed", type date}, {"Forms completed", type date}, {"Accepted Forms completed Pending Review", type date}}),
    Custom1 = Table.AddColumn(#"Changed Type","Final date", each List.Min(Record.ToList(_)), type date)
in
    Custom1

Hope this helps.

Untitled.png


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

@Ashish_Mathur Thank you. Can i do this as custom column as in my other table i have other columns as well

jhoyabel19_0-1674020220260.png

 

Hi,

See if this M code works

let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Offer Accepted", type date}, {"Offer Accepted (On Boarding)", type date}, {"Accepted forms reviewed", type date}, {"Forms completed", type date}, {"Accepted Forms completed Pending Review", type date}}),
    Custom1 = Table.AddColumn(#"Changed Type","Final date", each List.Min(List.Skip(Record.ToList(_),2)), type date)
in
    Custom1

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

Thank you. It worked, You're a saviour 🙂

You are welcome.  Please mark my previous reply as Answer.


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

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.