1

I am creating different list views for different pages so I can restrict access. Each list item contains dates for each day of the current week. The list items go back a couple months, so I would like to filter out everything that isn't apart of the current week. The Monday date for the list is calculated as =(2-WEEKDAY(Today)+(Today)).

Is there a way to add to the filter view to only show items where the Monday column is equal to the current Monday?

UPDATE

I have tried the following by initializing a variable and defining it as:

CurrentMonday =

formatDateTime(subtractFromTime(addDays(utcNow(), 1), dayOfWeek(utcNow()), 'Day'), 'yyyy-MM-dd')

When I test the GET by using this variable in my QueryFilter for the SharePoint list, I get the following error:

{
   "odata.error":{
      "code":"-1, Microsoft.SharePoint.Client.InvalidClientQueryException",
      "message":{
         "lang":"en-US",
         "value":"The expression \"Monday eq 'formatDateTime(subtractFromTime(addDays(utcNow(), 1), dayOfWeek(utcNow()), 'Day'), 'yyyy-MM-dd')'\" is not valid."
      }
   }
}

1 Answer 1

2

I highly recommend you check a post by @Jenny Hersko: https://jennyssharepointtips.wordpress.com/2016/10/22/show-this-week-only/

It is my understanding that your goal is to have a list view in SharePoint to only show list items that are part of this current week.

You can achieve this by adding 2 columns to your list:

Column Name Column Type Formula Formula Return type
Calc_WeekViewStart Calculated (calculation based on other columns) =Calc_WeekViewEnd-7 Date and Time (Date Only)
Calc_WeekViewEnd Calculated (calculation based on other columns) =RandomDate-WEEKDAY(RandomDate,2)+7

Where "RandomDate" is the column name for a "Date Only" column that holds any specific date.
Date and Time (Date Only)

Then you can config the list view to have a Filter: enter image description here

Here is the All Items view VS. the This Week Only view: enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.