Forum Discussion
Current week date filter applied to all days between two dates
- 2 years ago
Hi @SHenderosn
You should be able to achieve this by adding a calculated column in your PTO table that checks whether the specific record is in the current week or not. This column can then be used as a Slicer to filter whether a PTO falls within the Current Week.
Just update the below to your table and column names and it should work well. You can then add this as a slicer and achieve your desired output.
PTO_In_Current_Week = VAR _start = CALCULATE ( MIN ( 'DateTable'[Date] ) , 'DateTable'[CurrentWeekOffset] = 0 ) VAR _end = CALCULATE ( MAX ( 'DateTable'[Date] ) , 'DateTable'[CurrentWeekOffset] = 0 ) RETURN IF ( AND ( 'PTOTable'[Start Date] <= _end , 'PTOTable'[End Date] >= _start ) , "Current Week" , "Not Current Week" ) )Hope this works okay!
Theo
- Anonymous2 years ago
This is exactly what I needed, thank you!
Hi Anonymous
You should be able to achieve this by adding a calculated column in your PTO table that checks whether the specific record is in the current week or not. This column can then be used as a Slicer to filter whether a PTO falls within the Current Week.
You will need to update the table and column names to match your model but hopefully this will work for what you are trying to achieve. By doing it this way, you should be okay to leave your relationships etc as is.
PTO_In_Current_Week =
VAR _start =
CALCULATE (
MIN ( 'DateTable'[Date] ) , 'DateTable'[CurrentWeekOffset] = 0
)
VAR _end =
CALCULATE (
MAX ( 'DateTable'[Date] ) , 'DateTable'[CurrentWeekOffset] = 0
)
RETURN
IF (
AND (
'PTOTable'[Start Date] <= _end ,
'PTOTable'[End Date] >= _start ) ,
"Current Week" , "Not Current Week"
)
)
Hope this works okay!
Theo 🙂