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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
enterprised1
Helper I
Helper I

Evaluate multiple fields for blanks

Hi,

 

I have 3 fields which I want to evaluate to see if a process is complete.  My idea is to create a new column that says "Not Started," "Incomplete," or "All Complete."  If there's a better way to do it, i'm open to suggestions as well. 

 

Here's what I'm trying to do: If there's a date/timestamp in all 3 fields, it should say "All Complete" in the new column.  If any (but not all) of the fields have a datestamp, it should say "Incomplete."  If there are no datestamps in any of the fields, it should say "Not Started"

 

When I use the following nested IF statement,

IF(AND(ISBLANK([#"Date1"]),ISBLANK([#"Date2"]),ISBLANK([#"Date3"])),"Not Started",IF(OR(ISBLANK([#"Date1"]),ISBLANK([#"Date2"]),ISBLANK([#"Date3"])),"Incomplete",IF(AND(NOT(ISBLANK([#"Date1"])),NOT(ISBLANK([#"Date2"])),NOT(ISBLANK([#"Date3"]))),"All Complete")))

 

the Query Editor returns "Expression error: The name 'IF' wasn't recognized. Make sure it's spelled correctly."

 

Any ideas on what I'm doing wrong?

 

Thanks!

1 ACCEPTED SOLUTION
SabineOussi
Skilled Sharer
Skilled Sharer

@Sean is right! I only focused on the formula and did not pay attention to query editor.

My solution would work in data view using DAX by adding a new calculated column, from there you do the proper calling to dates instead of using #.

 

So in your case by adding a custom column from the query editor, you should write the following

 

if
([#"Date1"]="" and [#"Date2"]="" and [#"Date3"]="")
then "Not Started"
else if
([#"Date1"]="" or [#"Date2"]="" or [#"Date3"]="")
then "Incomplete"
else "All Complete"

 

I'm also learning as I'm trying to help!

 

 

View solution in original post

4 REPLIES 4
SabineOussi
Skilled Sharer
Skilled Sharer

@Sean is right! I only focused on the formula and did not pay attention to query editor.

My solution would work in data view using DAX by adding a new calculated column, from there you do the proper calling to dates instead of using #.

 

So in your case by adding a custom column from the query editor, you should write the following

 

if
([#"Date1"]="" and [#"Date2"]="" and [#"Date3"]="")
then "Not Started"
else if
([#"Date1"]="" or [#"Date2"]="" or [#"Date3"]="")
then "Incomplete"
else "All Complete"

 

I'm also learning as I'm trying to help!

 

 

That worked like a charm!  Thanks a million!  Been trying to figure that one out for days!

Sean
Community Champion
Community Champion

this error indicates you are trying to write in M but using DAX syntax

 

M is very case sensitive - if.... then.... else (if)

SabineOussi
Skilled Sharer
Skilled Sharer

The problem is ANDs and ORs only take two logical arguments and you're giving them three.

 

The below statement should work fine:

IF(AND(AND(ISBLANK([#"Date1"]),ISBLANK([#"Date2"])),ISBLANK([#"Date3"])),"Not Started",

IF(OR(OR(ISBLANK([#"Date1"]),ISBLANK([#"Date2"])),ISBLANK([#"Date3"])),"Incomplete",

IF(AND(AND(NOT(ISBLANK([#"Date1"])),NOT(ISBLANK([#"Date2"]))),NOT(ISBLANK([#"Date3"]))),"All Complete")))

 

Hope this helps!

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.