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
ArchStanton
Post Prodigy
Post Prodigy

OR Operator affecting my IF Statement

Does anyone know why and how to stop this code giving me a TRUE/FALSE in my calculated column?

 

Validation to Closure = IF(ISBLANK('Cases'[applicationvalidationdate]),BLANK() || IF(ISBLANK('Cases'[Resolution Date]),BLANK(),
                        DATEDIFF('Cases'[applicationvalidationdate],'Cases'[Resolution Date],DAY))+1)

 

It is something to do with the || (OR) operator because without the || there is no TRUE/FALSE only a DATEDIFF Count.

 

IF(ISBLANK('Cases'[applicationvalidationdate]),BLANK(),
                        DATEDIFF('Cases'[applicationvalidationdate],'Cases'[Resolution Date],DAY))+1

 

Thanks

3 ACCEPTED SOLUTIONS
AlexisOlson
Super User
Super User

Yes. If you have A || B, then the expected result is true/false.

 

Did you mean to write your measure like this:

Validation to Closure =
IF (
    ISBLANK ( 'Cases'[applicationvalidationdate] ) || ISBLANK ( 'Cases'[Resolution Date] ),
    BLANK (),
    DATEDIFF ( 'Cases'[applicationvalidationdate], 'Cases'[Resolution Date], DAY ) + 1
)

View solution in original post

DOLEARY85
Super User
Super User

Hi,

 

The OR statement shouldn'e be an issue, might be the way it's worded with 2 If statements instead of just 1 with an OR.  Try this:

 

Validation to Closure = if('Cases'[applicationvalidationdate] = BLANK()||'Cases'[Resolution Date]= blank(), BLANK(), DATEDIFF('Cases'[applicationvalidationdate],'Cases'[Resolution Date],DAY)+1)
 
DOLEARY85_0-1708447267499.png

If I answered your question, please mark my post as solution, Appreciate your Kudos 👍

View solution in original post

This is perfect - many thanks!

View solution in original post

4 REPLIES 4
DOLEARY85
Super User
Super User

Hi,

 

The OR statement shouldn'e be an issue, might be the way it's worded with 2 If statements instead of just 1 with an OR.  Try this:

 

Validation to Closure = if('Cases'[applicationvalidationdate] = BLANK()||'Cases'[Resolution Date]= blank(), BLANK(), DATEDIFF('Cases'[applicationvalidationdate],'Cases'[Resolution Date],DAY)+1)
 
DOLEARY85_0-1708447267499.png

If I answered your question, please mark my post as solution, Appreciate your Kudos 👍

Thanks for the quick reply - that works!

AlexisOlson
Super User
Super User

Yes. If you have A || B, then the expected result is true/false.

 

Did you mean to write your measure like this:

Validation to Closure =
IF (
    ISBLANK ( 'Cases'[applicationvalidationdate] ) || ISBLANK ( 'Cases'[Resolution Date] ),
    BLANK (),
    DATEDIFF ( 'Cases'[applicationvalidationdate], 'Cases'[Resolution Date], DAY ) + 1
)

This is perfect - many thanks!

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.