Forum Discussion
If a date falls between dates, return a value
Hi IBrant ,
Try this :-
Iteration =
VAR _Date = [Date]
RETURN
CALCULATE(
MAX ( Iterations[FY] ),
Iterations[StartDate] <= _Date && Iterations[EndDate] >= _Date
)Thanks ,
Pratyasha Samal
Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C
Iteration was not recognized in DAX or M. I also do not want it to calculate the number of FY, I want it to show the FY in the FY column. I will then be able to create many different visuals based on that information. For example, in the FY column, I would like to have FY22, FY23, etc returned based on the date in the Date_Onboard column.
- pratyashasamal3 years agoMemorable Member
Use your table name place of TableName :-
Try this out if you want to return 0 or 1Final = VAR _Date = [Date] VAR Result = IF(TableName[StartDate] <= _Date && TableName[EndDate] >= _Date , 1, 0) ) RETURN ResultIf you want to return FY value :-
Final =
VAR _Date = [Date]
VAR Result =
IF(TableName[StartDate] <= _Date && TableName[EndDate] >= _Date , TableName[FY])
)
RETURN
ResultThanks,
Pratyasha Samal
Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C- IBrant3 years agoFrequent Visitor
It isn't giving me an option to refer to another table for the start and end date range to return FY. I need it to look at the "Date Onboard" column and if that date is between 10/1/2021 and 10/1/2022, return FY22, if not return "". OR it can look at the seperate table I pasted above and return the FY if the "Date Onboard" is in the listed ranges on that other table.
- IBrant3 years agoFrequent Visitor
This is my table: