“Last 7 days” sounds precise, but it can mean today and the six days before, or the seven complete days before today. QuickSight’s relative date filter gives you the first. A calculated field with now() gives you whichever you define.

Copy and paste

The 7 complete days before today (today excluded):

ifelse(
  {Order Date} >= addDateTime(-7, 'DD', truncDate('DD', now()))
  AND {Order Date} < truncDate('DD', now()),
  'Yes', 'No')

Today and the 6 days before:

ifelse({Order Date} >= addDateTime(-6, 'DD', truncDate('DD', now())), 'Yes', 'No')

N chosen by the reader (an Integer parameter named DaysBack):

ifelse(
  {Order Date} >= addDateTime(-1 * ${DaysBack}, 'DD', truncDate('DD', now()))
  AND {Order Date} < truncDate('DD', now()),
  'Yes', 'No')

Create the field in the analysis, add a filter on it and keep Yes.

The relative date filter

Without any formula: add a filter on {Order Date}, choose Relative dates, the period Days and Last N days. The AWS documentation defines “last N” as the current period plus the N − 1 before it, so Last 7 days includes today, whether or not today’s data has arrived. Future dates within today are included too.

That suits data that updates during the day. For a table loaded overnight, today is empty or partial, and the last 7 days contain only six full days. Use the first formula instead, or check whether the filter’s Exclude last option, available when the dates are relative to the current date and time, fits your case.

How the formula works

truncDate('DD', now()) is today at midnight. Going back 7 days gives the start of the range, and < today at midnight ends it before today begins. The two bounds work the same on date and timestamp fields, so an order at 18:00 yesterday is in and one at 08:00 today is out.

The result is text, Yes or No, so QuickSight treats the field as a dimension and offers a simple value filter. With 1 and 0 it would become a measure and the filter would aggregate it.

Keep now() in the analysis

In a SPICE dataset, row-level calculated fields are computed and stored at refresh time. A dataset field built on now() would freeze “today” at the last refresh. Created in the analysis, it is evaluated when the visual loads.

Which “today”

For SPICE datasets, now() returns the time in UTC; for direct queries, the database’s time. A reader in Rome at 00:30 is still in “yesterday” for UTC. If that matters, set the analysis time zone (Edit → Analysis settings → Date and time): the documentation says now() and relative date filters then follow it.

Checked against the Amazon Quick Sight documentation (October 2026).

References