We help IT Professionals succeed at work.

Excel Pivot Table

pepps11976
pepps11976 asked
on
Hi all

I have an excel Spreadsheet that is connected to a SQL Database. it has a list of orders on it that go back to 2009.

I would like to base a pivot table on the data but was wondering how i could make the pivot table automatically change if say i added date filters on the raw data on sheet 1 how could i make the pivot table reflect these changes also on shhet 2.

Thanks

John
Comment
Watch Question

CERTIFIED EXPERT
Most Valuable Expert 2011
Top Expert 2011

Commented:
Which version of Excel?

Unless you specifically need to filter the raw data as well, I would suggest simply filtering the pivot table directly. If you do need to filter the raw data too, you will probably need code - in which case we would ideally need a sample workbook to see the data layout.

Author

Commented:
Its the 2007 version.

basically a users filters the report every month to send to our customers so generally they would filter for the current month.

And so i would like the pivot table to reflect the change.

John
CERTIFIED EXPERT
Most Valuable Expert 2011
Top Expert 2011

Commented:
Would it not make more sense to have the source query filtered? Then you only have the required data in the file and the pivot table is always current.

Author

Commented:
I did try that i filtered the source data on last month a nd created a pivot table, then i changed the filter on the source data to current month but the pivot table stayed the same.

the user would be changing to the current month every month

John
CERTIFIED EXPERT
Most Valuable Expert 2011
Top Expert 2011

Commented:
I mean the source query not the data in the workbook. You would then simply need to refresh the pivot table.

Author

Commented:
Yes i see what you mean.

only then it would mean myself having to re query the sql data every month, not really ideal.


John
CERTIFIED EXPERT
Most Valuable Expert 2011
Top Expert 2011

Commented:
Do you not have to do that anyway to make sure the data is up to date?

Author

Commented:
The Sql Data is connected to a foxpro table, the sql query is refreshed every 20 mins.

And the SQL query has data init that goes back years, it has all order history etc, so i use excel to pnly pick out the information that i need.

John
CERTIFIED EXPERT
Most Valuable Expert 2011
Top Expert 2011
Commented:
What I am really suggesting is a SQL query that returns only a specific month's data based on a parameter. You could then use an Excel cell as the parameter value so that the table in Excel only has one month's data in it, so just refreshing the pivot table will keep it up to date. You could alternatively base the pivot directly on your SQL data and not store the data on a sheet at all (depends if you need that detail).

Explore More ContentExplore courses, solutions, and other research materials related to this topic.