Forum Discussion
Understanding DATESBETWEEN
- 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.
Thanks, Greg.
Does that mean local functions such as TODAY() or its derivates cannot be used with DATESBETWEEN?
Any suggestions to achieve this pseudo code?
[DateColumn1] between <current_date> and <current_month_end_date>
[DateColumn1] between <current_date> and [DateColumn2]
This is not an uncommon scenario!
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.
- KeldAlmand7 years agoRegular Visitor
Hi Greg, i´m quiet new for coding, hope you could help me.
I have the same problem. I want to figure out wether a given date in one column is a date between that date and TODAY()
My code is like this:
Kolonne 4 = IF(COUNTX(DATESBETWEEN(Tabel1[DateOne];TODAY()>0;1;0)))
The error says somthing like this: To few arguments for the function DATESBETWEEN, there must be at least 3 argument for this function.
Sorry - I would like to make a new tread bud dont have the button for that, so i try to put my question here.
Best regards