Forum Discussion
Anonymous
5 years agoNot applicable
Quick Q: Datesbetween with If statement
I want to use DatesBetween in an IF Statement: =if(DatesBetween(Table[Date], Date(2021,03,09), Date(2021,03,21)),1,0) This won't work because DatesBetween Returns a table of the dates between...
- 5 years ago
Hi Anonymous ,
Try with this code..
Measure = IF ( AND ( Table[Date] >= DATE ( 2021, 03, 09 ), Table[Date] <= DATE ( 2021, 03, 21 ) ), 1, 0 ) - Anonymous5 years ago
hi Anonymous try with below measure
Measure = IF (MAX('Table'[Date])>= DATE ( 2021, 03, 01 )&&MAX(Table[Date]) <= DATE ( 2021, 08, 31 ),1,0)
- Anonymous5 years ago
HI Anonymous,
You can also use the aggregate function to extract the current date and use the calendar function to generate the date range and use the 'in' operator to compare with them.
Measure = VAR currDate = MAX ( Table[Date] ) VAR dateRange = CALENDAR ( DATE ( 2021, 03, 09 ), DATE ( 2021, 03, 21 ) ) RETURN IF ( currDate IN dateRange, 1, 0 )Regards,
Xiaoxin Sheng
Angith_Nair
5 years agoContinued Contributor
Hi Anonymous ,
Try with this code..
Measure =
IF (
AND ( Table[Date] >= DATE ( 2021, 03, 09 ), Table[Date] <= DATE ( 2021, 03, 21 ) ),
1,
0
)