Pivot Table Last 12 Months Filter

animas

Active Member
Joined
Sep 28, 2009
Messages
396
How can I put an automatic filter in pivot table so that it only shows last 12 months data?

If today is Oct'10, filtered data will show between Oct'09 to Oct'10.
If today is Nov'10, filtered data will show between Nov'09 to Nov'10. This way I won't need to update the filter each month.

How can I do that?

Thanks.
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Hi,

This is untested. Create the pivot table in a new workbook via the wizard ALT-D-P and the 'external data source' option. (If you haven't used non-dynamic defined names, OK to acknowledge the message about no visible data sources and then choose 'options' and 'system tables' so that you can see worksheet names.) Go to the final step and choose to edit in MS Query. Edit the SQL ('SQL' button) to something like below. OK to enter that, see the dataset and then use the 'open door' button and complete the pivot table.

regards, F
Code:
SELECT *
FROM your_table
WHERE YourDateField Between Date AND Date - 365
 
Upvote 0
I omitted to say above that the resultant worksheet containing the pivot table can be moved into the source data file.
 
Upvote 0
Date isn't right.

Please change in above SQL to either Date() or Now in the WHERE clause. That is,
Code:
SELECT *
FROM your_table
WHERE YourDateField BETWEEN Date()-365 AND Date()
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,751
Members
448,989
Latest member
mariah3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top