Excel 2007 Pivot Table Question : Grouping

bradjedis
4StarLounger
Posts: 538
Joined: 30 Mar 2010, 18:49
Location: United States

Excel 2007 Pivot Table Question : Grouping

Post by bradjedis »

Greetings!

I have a file where there are 2 pivot tables for the same data range. When I created the 2nd pivot table it appears that excel used the same table name.

My issue is that I need to group the data differently on the 2 tables. The grouping is on the first table for a weekly grouping. The second is for monthly. The problem is in that when I group on one of the tables it un-does the grouping on the other table.

Any thoughts? I can post a file but it will take a little while to sanitize the data. (you know, propriatary etc...)


Thanks,
Brad

User avatar
HansV
Administrator
Posts: 78545
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Excel 2007 Pivot Table Question : Grouping

Post by HansV »

When you create a new pivot table from the same data as an existing one, you'll be prompted whether you want to base the new one on the existing one. If you answer No, the pivot tables will behave independently of each other.
The dialog below is for Excel 2003, I assume it's similar for Excel 2007.
x33.png
You do not have the required permissions to view the files attached to this post.
Best wishes,
Hans

bradjedis
4StarLounger
Posts: 538
Joined: 30 Mar 2010, 18:49
Location: United States

Re: Excel 2007 Pivot Table Question : Grouping

Post by bradjedis »

That is what I expected, but 2007 did not ask. Pephaps it is a setting somewhere?

Brad

bradjedis
4StarLounger
Posts: 538
Joined: 30 Mar 2010, 18:49
Location: United States

Re: Excel 2007 Pivot Table Question : Grouping

Post by bradjedis »

Found a solution. Not sure if it is the Best, but it works.

I set 2 Named ranges. same range differnt names. Then adjusted the data range for each pivot table to point at the specific named range.

Brad

User avatar
HansV
Administrator
Posts: 78545
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Excel 2007 Pivot Table Question : Grouping

Post by HansV »

You're correct. Apparently it is not possible to specify this in the interface of Excel 2007 any more - another example of loss of functionality.

You've found a relatively simple workaround. Another one is to use code to create a new pivot cache, and use this for a new pivot table that will behave independently of others, for example:

Dim wsh As Worksheet
Dim pvc As PivotCache
Dim pvt As PivotTable
Set wsh = ActiveSheet
Set pvc = ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:=wsh.Range("A1:D20"))
Set pvt = pvc.CreatePivotTable(TableDestination:=wsh.Range("G52"))

You'd still have to add the row fields, column fields and value fields.
Best wishes,
Hans