Forum Discussion
Lookup value if date is between two dates
- Anonymous7 years ago
I don't think you've told us all about the model... I suspect there are relationships between the two tables based on the date fields.
Try this
CreatedInSprint = var __date = WorkItems[fields_SystemCreatedDate] return MAXX( FILTER( Sprints; AND( Sprints[attributes_startDate] <= __date, __date <= Sprints[attributes_finishDate] ) ), Sprints[SprintNo] )
This should work correctly on the assumption that there is always at most one sprint returned by the logical condition in FILTER. If there happen to be many, then the maximum SprintNo will be returned.
Best
Darek
I don't think you've told us all about the model... I suspect there are relationships between the two tables based on the date fields.
Try this
CreatedInSprint = var __date = WorkItems[fields_SystemCreatedDate] return MAXX( FILTER( Sprints; AND( Sprints[attributes_startDate] <= __date, __date <= Sprints[attributes_finishDate] ) ), Sprints[SprintNo] )
This should work correctly on the assumption that there is always at most one sprint returned by the logical condition in FILTER. If there happen to be many, then the maximum SprintNo will be returned.
Best
Darek
Hi @Anonymous, would you be able to help with a similar question. I have a table in which i am looking to return true/false for a date which comes after the Date_from column and before the Date_until column date. I have tried a regular DAX expression of
InRangeDate = and(DELNOTES[DELNOTE_DATE]>=DELNOTES[DATE_FROM],DELNOTES[DELNOTE_DATE]<=DELNOTES[DATE_UNTIL]) but this only returns TRUE in all instances. I have then tried to hard code the date for a given accounting period using this expression