Filter List View by Current Week

If you want to be able to filter the list to only show items where “Date” is this week,

Most common option that appears first is to filter for the last seven days, using a calculated column for [Date]+7 with formula like

=DATE(YEAR([Created]),MONTH([Created]),DAY([Created])+7)

and filtering the view where this new calculated column is >=[Today]

But it is really last 7 days not the week period. I.e. If today is Wednesday, view should display items from Monday to upcoming Sunday (actual current week)

For this solution replace the with appropriate DateTime field base on which you want to filter the view.

  1. Create a calculated column named WeekStart returning type DateTime, with the calculation:

    =IF(TEXT(WEEKDAY(<>),”ddd”)=”Mon”,<>,IF(TEXT(WEEKDAY(<>-1),”ddd”)=”Mon”,<>-,IF(TEXT(WEEKDAY(<>-2),”ddd”)=”Mon”,<>-2,IF(TEXT(WEEKDAY(<>-3),”ddd”)=”Mon”,<>-3,IF(TEXT(WEEKDAY(<>-4),”ddd”)=”Mon”,<>-4,IF(TEXT(WEEKDAY(<>-5),”ddd”)=”Mon”,<>-,<>-6))))))

  2. Create a calculated column named WeekEnd returning type <>time, with the calculation: =IF(TEXT(WEEKDAY(<>),”ddd”)=”Sun”,<>,IF(TEXT(WEEKDAY(<>+1),”ddd”)=”Sun”,<>+1,IF(TEXT(WEEKDAY(<>+2),”ddd”)=”Sun”,<>+2,IF(TEXT(WEEKDAY(<>+3),”ddd”)=”Sun”,<>+3,IF(TEXT(WEEKDAY(<>+4),”ddd”)=”Sun”,<>+4,IF(TEXT(WEEKDAY(<>+5),”ddd”)=”Sun”,<>+5,<>+6))))))
  3. Create a view with the following filter:

    Column: WeekStart <= [Today] AND WeekEnd >= [Today] Source:webcache.googleusercontent.com

0 nhận xét:

Post a Comment

thanks comment