I recently did a workshop with one of my customers where we were building a PowerPivot model which was later used for several reports. The final workbook contained 10+ worksheets each with one or more PivotTables querying the PowerPivot model. Most of the PivotTables had several filters in common. For example Year, Period, Organisation and so on. A very important requirement for the customer was that whenever one of those filters is changed, all other PivotTables in the workbook should also be synchronized and filtered accordingly.
A common solution for this problem is to use a VBA-Macro that pushes changes in the filter across all PivotTables. This approach is described in many blogs and/or forum entries:
This solutions works fine but has the same drawback as all other VBA Macros:
- Users may need special security to use macros as they could be unsafe
- Macros may be forbidden by your company
- and (especially for BI) THEY DO NOT WORK WITH EXCEL SERVICES!!!
Also for my customer macros have not been an option. As I could not find any other solution in the web, I was very happy when one of my colleagues showed me an other option to solve this issue.
We did not use any macros but only used native, built-in excel functionalities – Slicers.
And this is how it works:
- Create a two PivotTables on top of your datasource (I tested multidimensional and tabular datasources, but I assume that this will also work for all other datasources)
- Add the same field(s) to the Report-Filter of your PivotTables
- Use rows, columns and values as you like
- In my example I used the Adventore Works cube and created the following worksheet:
I used [Date].[CalendarYear] in both PivotTables as a filter. As you already know these filters are independent of each other usually.
To solve the initial problem and keep them in sync you first have to add a new slicer also for [Date].[CalendarYear]
and connect it to both PivotTables:
And that’s actually all you have to do!
Now you can either change the filter of PivotTable1, PivotTable2 or use the slicer to select your CalendarYear. The selection will be propagated through all objects that are connected to the slicer!
Another neat feature of slicers is, that the do not have to reside on the same worksheet as the connected PivotTables. So you could also move them to a hidden worksheet and everything will still work!
Also multiselects work just fine!
You may also want to put hierarchies into the filter – this also works
But be aware that one slicer is created for each hierarchy-level!
I have not tested this solution in Excel-Services and SharePoint yet but I assume that it will also work there. When I have some more time I will test this and post my results.
UPDATE: I just ran some tests on SharePoint and this solution also works with Excel-Services