![](https://cdn.wiki-base.com/3235092/pivot_table_pivot_table_last_7_days_.png.webp)
Per creare una tabella pivot che mostri gli ultimi 7 giorni di dati (o, più in generale, gli ultimi n giorni) puoi aggiungere una colonna helper ai dati di origine con una formula per contrassegnare i record negli ultimi 7 giorni, quindi utilizzare l'helper colonna per filtrare i dati nella tabella pivot. Nell'esempio mostrato, la data corrente è il 16 agosto 2019 e la tabella pivot mostra i sette giorni precedenti.
Campi
Nella tabella pivot mostrata, ci sono quattro campi in uso: Data, Posizione, Vendite e Filtro. Posizione è un campo Colonna, Data è un campo Riga, Vendite è un campo Valore e Filtro (la colonna helper) è un campo Filtro, come mostrato di seguito:
Formula
La formula usata in E5, copiata in basso, è:
=AND(B5>=(TODAY()-7),B5
This formula returns TRUE when a record date is greater than or equal to today's date - 7, and also less than today's date.
Steps
Add helper column with formula to data as shown
Create a pivot table
Add fields to Row, Column, and Value areas
Add helper column as a Filter, filter on TRUE
Related pivots
Pivot table filter by weekday To create a pivot table with a filter for day of week (i.e. filter on Mondays, Tuesdays, Wednesdays, etc.) you can add a helper column to the source data with a formula to add the weekday name, then use the helper column to filter the data in the…
Pivot table last 12 months To create a pivot table that shows the last 12 months of data (i.e. a rolling 12 months), you can add a helper column to the source data with a formula to flag records in the last 12 months, then use the helper column to filter the data in the pivot…
![](https://cdn.wiki-base.com/3235092/pivot_table_pivot_table_last_7_days__5.png.webp)
Pivot Table Training
If you use Excel, but don't know how to use Pivot Tables, you're missing out… wasting time trying to do things that a Pivot Table can do for you automatically. Core Pivot is a step-by-step Excel video course that will teach you everything you need to know to use this powerful tool. With a small investment, Pivot Tables will pay you back again and again. See details here.