Forum Discussion

shampbi's avatar
shampbi
New Member
7 years ago
Solved

Understanding DATESBETWEEN

Could anyone tell me what is the difference between the following two expressions? IF (DATESBETWEEN(Table[DateColumn], TODAY(), CustomTable[LastOfMonth]), 1, 0) IF (DATESBETWEEN(Table[DateColumn], ...
  • Greg_Deckler's avatar
    Greg_Deckler
    7 years ago

    Nope, I messed up. The issue is that you are returning a table of values to your IF statement and it is getting confused by that as it is expecting a TRUE/FALSE or numeric value. So, you would need to do this:

     

    Measure = IF (COUNTX(DATESBETWEEN(Table[DateColumn], TODAY(), CustomTable[LastOfMonth]),[DateColumn])>0, 1, 0)

    DATESBETWEEN will return a single column table of dates between the specified dates. But, that is not a valid input to the first argument of an IF function, so you have to do something with that table of dates, like count how many there are.