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
wkelly1002
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
Anonymous
Not applicable

Try

 

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

View solution in original post

Anonymous
Not applicable

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

 

Smiley Happy

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

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

The abve one should work.

 

Thanks

Raj 

Anonymous
Not applicable

Try

 

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

Thank you so much it worked!

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

Anonymous
Not applicable

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

 

Smiley Happy

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.

Top Solution Authors