![](https://cdn.wiki-base.com/8082670/pivot_table_pivot_table_last_12_months_.png.webp)
Untuk membuat jadual pangsi yang menunjukkan data 12 bulan terakhir (iaitu 12 bulan bergulir), anda boleh menambahkan lajur pembantu ke data sumber dengan formula untuk menandakan rekod dalam 12 bulan terakhir, kemudian gunakan lajur penolong untuk menapis data dalam jadual pangsi. Dalam contoh yang ditunjukkan, tarikh semasa adalah 23 Ogos 2019, dan jadual pangsi menunjukkan 12 bulan sebelumnya. Apabila data baru ditambahkan dari masa ke masa, jadual pangsi akan terus mengesan 12 bulan sebelumnya berdasarkan tarikh semasa.
Padang
Dalam jadual pangsi yang ditunjukkan, terdapat tiga bidang dalam data sumber: Tarikh, Penjualan, dan Penapis. Tapisan adalah ruang penolong dengan formula yang menandakan 12 bulan terakhir. Medan Tarikh telah dikumpulkan mengikut Tahun dan Bulan:
Formula
Rumus yang digunakan dalam E5, disalin, adalah:
=AND(B5>=EOMONTH(TODAY(),-13)+1,B5
This formula returns TRUE when a date is greater than or equal to the first day of the month 12 months earlier and when the date is less than the last day of the previous month. The formula uses the AND, TODAY, and EOMONTH functions as explained here.
Steps
Add helper column with formula to data as shown
Create a pivot table
Add Sales as a Value field
Add Date as a Row field
Group Date by Year and Month
Disable subtotals for Year
Add helper column as a Filter, filter on TRUE
Related pivots
Pivot table last 7 days To create a pivot table that shows the last 7 days of data (or, more generally, the last n days) you can add a helper column to the source data with a formula to flag records in the last 7 days, then use the helper column to filter the data in the…
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…
![](https://cdn.wiki-base.com/8082670/pivot_table_pivot_table_last_12_months__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.