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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
james_pease
Helper III
Helper III

Need help with combing If or and if and statements

Hello all, I am trying to pass multiple tests that return "yes." The first test is to see if an employees last pay day is greater than 21 days, the second is to test wether their last pay date is blank and if so, return yes if their hire date is greater than 21 days from today. 

Here is what I have so far:

Active No Hours = IF(DATEDIFF('ADP Active Employees'[Last Pay Date], TODAY(), DAY)>21, "Yes")
||IF(AND(LEN('ADP Active Employees'[Last Pay Date]) <0,
DATEDIFF('ADP Active Employees'[Last Pay Date], TODAY(), DAY)>21),"Yes")
 
I have tried using ISBLANK with "If and" but it kept saying two few arguments were passed, which is what led me to try "If and" with a Len <0. Thank you in advance!
1 ACCEPTED SOLUTION

@james_pease 

Please try

 

Active No Hours =
IF (
    DATEDIFF ( 'ADP Active Employees'[Last Pay Date], TODAY (), DAY ) > 21
        || AND (
            ISBLANK ( 'ADP Active Employees'[Last Pay Date] ),
            DATEDIFF ( 'ADP Active Employees'[Last Pay Date], TODAY (), DAY ) > 21
        ),
    "Yes"
)

 

View solution in original post

5 REPLIES 5
tamerj1
Super User
Super User

Hi @james_pease 

please try

Active No Hours =
IF (
    DATEDIFF ( 'ADP Active Employees'[Last Pay Date], TODAY (), DAY ) > 21
        || AND (
            LEN ( 'ADP Active Employees'[Last Pay Date] ) < 0,
            DATEDIFF ( 'ADP Active Employees'[Last Pay Date], TODAY (), DAY ) > 21
        ),
    "Yes"
)

Thank you, but for some reason its not reutrning the employees with an blank last pay date (empty cell). Its passing the first arguement fine, but for some reason, its not testing if the last pay date is blank, then return yes if hire date is > than 21 days from today.

james_pease_1-1664208933212.png

 

Here is a screenshot, I blacked out names for privacy. Notice how it is not returing a "yes" for those without a last pay date and their hire date is > today + 21 days?

 

AHHH so sorry, I needed to change the second clause to

 DATEDIFF ( 'ADP Active Employees'[Hire/Rehire Date], TODAY (), DAY ) > 21

Works like a charm!

@james_pease 

Please try

 

Active No Hours =
IF (
    DATEDIFF ( 'ADP Active Employees'[Last Pay Date], TODAY (), DAY ) > 21
        || AND (
            ISBLANK ( 'ADP Active Employees'[Last Pay Date] ),
            DATEDIFF ( 'ADP Active Employees'[Last Pay Date], TODAY (), DAY ) > 21
        ),
    "Yes"
)

 

Sadly, same result:

james_pease_0-1664209538354.png

Notice how there are 1501 blanks, I am expecting several to say "yes" in the 'Active No Hours column'

james_pease_1-1664209784818.png

 

james_pease
Helper III
Helper III

I have also tried the following:

IF(OR(DATEDIFF('ADP Active Employees'[Last Pay Date], TODAY(), DAY)>21,
IF(AND(LEN('ADP Active Employees'[Last Pay Date]) <0,
DATEDIFF('ADP Active Employees'[Last Pay Date], TODAY(), DAY)>21),"Yes")), "Yes")
 
The second arguement isnt being passed because its using it as the true statement versus a second argument.
But the results are less than what I am expecting, the  

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.