cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
wkelly1002 Frequent Visitor
Frequent Visitor

Need help with an IF ... AND ... Statement

If([Reference Date]-[CREATE DATE]>22,
         
AND([Reference Date]-[CREATE DATE]<31,
             "Y",
             "N"))) 

Hello, I am new to writing DAX equations with Power BI and need some help with an IF ... AND ... statemment for a calculated column.

 

 

Basically I am trying to write out:

 

IF (xdate - ydate)>21 days
AND ((xdate - ydate)<31 days

 

Display "Y"

 

If not, display "N"

 

Here is what I have so far

2 ACCEPTED SOLUTIONS

Accepted Solutions
SWOS Regular Visitor
Regular Visitor

Re: Need help with an IF ... AND ... Statement

Try

 

if(and([Reference Date]-[CREATE DATE]>22,[Reference Date]-[CREATE DATE]<31)."Y","N")

SWOS Regular Visitor
Regular Visitor

Re: Need help with an IF ... AND ... Statement

Just use the same format, but replace the if(and( with if(or(

 

Smiley Happy

4 REPLIES 4
SWOS Regular Visitor
Regular Visitor

Re: Need help with an IF ... AND ... Statement

Try

 

if(and([Reference Date]-[CREATE DATE]>22,[Reference Date]-[CREATE DATE]<31)."Y","N")

Super User
Super User

Re: Need help with an IF ... AND ... Statement

IF([Reference Date]-[CREATE DATE] >22 && [Reference Date]-[CREATE DATE]<31,       
            "Y",
             "N")

The abve one should work.

 

Thanks

Raj 

wkelly1002 Frequent Visitor
Frequent Visitor

Re: Need help with an IF ... AND ... Statement

Thank you so much it worked!

Do you know how to insert the OR operator into a DAX equation?

SWOS Regular Visitor
Regular Visitor

Re: Need help with an IF ... AND ... Statement

Just use the same format, but replace the if(and( with if(or(

 

Smiley Happy