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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Antonio195754
Helper IV
Helper IV

Trying to write an IF statement using OR

Greetings,

 

I'm trying to write a statement for a column that shows 3 types of values: Complete, Not Complete, Not Assigned.

 

I need both "Complete" OR "Not Assigned" to return a "0", else "1".

 

I can write =if('Database'[Column]="Complete","0","1")) And that returns a 0 anytime it shows complete.  What i can't get in one statement is for it to return a zero if it sees "Complete" or "Not Assigned" in the column.

 

Is that possible?

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

Try this calculated column formula

=if(OR('Database'[Column]="Complete",'Database'[Column]="Not Assigned"),0,1)

Hope this helps.


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

View solution in original post

4 REPLIES 4
Greg_Deckler
Super User
Super User

Column = if('Database'[Column]="Complete" || 'Database'[Column]="Not Assigned","0","1"))

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler This method also worked for me.  all my visuals that hinged to that missing link then worked.  thanks so much

Yeah, they are equivalent. I just find the || and && easier because as I am thinking through the logic, that's how I think, if this or that... not "if well let's see it will be this or that so I need to start with OR".

Rubbish!! 🙂

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Ashish_Mathur
Super User
Super User

Hi,

Try this calculated column formula

=if(OR('Database'[Column]="Complete",'Database'[Column]="Not Assigned"),0,1)

Hope this helps.


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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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