My question to you is, are you trying to just filter out anything that expired in the last 2 weeks?, or do you want to actually change the status of those items in a separate column?
If you are only looking to hide them from view, in the filter section of the View Settings...
Show the items when column:
Expiry Date | is less than | [Today]
AND
Expiry Date | is greater than or equal to | [Today]-14
This is a view not a calculated column, so there is no "Status" column identifying the item as 'Expired', they simply will not show.
If you want a column that specifically labels items as 'Expired' you can use a Power Automate Flow:
- Add a new column with name Status, type Single Line of text, and default value of 'Active' or 'Not Expired' or whatever you want
- Create a Scheduled Flow set to run at 12:15am every 1 day
- Add action Get Items, set the Site Name and List Name and type into the ODATA Filter: "Expiry_x0020_Date lt "
- Use the expression builder and enter: "formatDateTime(utcNow(), 'yyyy-MM-dd')"; click Add to add the date information as a variable that will update daily; this will grab all items with Expiry Date before today.
- Add action Update Item; set the Site Name and List Name; and use the dynamic content button to select the ID from the Get Items action; this will cause the Get Items action to be encapsulated in a For Each container
- Expand the Advanced Parameters and for the Status field, enter
Expired
- Add action Terminate
Save. Your flow is now ready to go and will update the Status field for all items with an Expiry Date before today to Expired at 12:15am every day. You can manually trigger the flow by running a test and that will also change over all of the currently expired ones.
You can then create a list view to include or exclude items that are Expired, and/or use Conditional Formatting to highlight them.
If you want other options on your Status field, you can:
- Set the type to Choice
- Create the list of choices, and a default value
- Add "Status ne [replace with excluded status]" to your ODATA Filter; this will cause the Get Items action to ignore that status
You can use the steps above as a foundational framework for setting up additional updates and ODATA filters to change the Status, or other fields based on date.
Hope this helps, sorry its a few years late.
Helpful Links: