Synchronizing PivotTable Filters without using VBA

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:
http://www.excelforum.com/excel-programming/778048-synchronizing-two-pivot-tables-of-same-data-with-one-report-filter.html
http://www.ozgrid.com/forum/showthread.php?t=87519

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:

  1. 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)
  2. Add the same field(s) to the Report-Filter of your PivotTables
  3. Use rows, columns and values as you like
    In my example I used the Adventore Works cube and created the following worksheet:
    InitialPivotTables

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]

PivotTablesWithSlicer

and connect it to both PivotTables:

SlicerConnections

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

6 thoughts on “Synchronizing PivotTable Filters without using VBA

  1. Pingback: How to link several pivot tables by a Combo box?

  2. Great tip. My challenge is that I have 2 pivot tables on the same sheet with the same filters, however, the data is coming in from 2 tables so your tip did not work for me. I will try joining the tables to determine if I can make it work.

  3. Hi,
    Not working for me.
    If i click on slicer it works, but if one of pivot table filters had changed
    there is no impact on the slicer on the second pivot table.

    • Hi Dimitri,
      make sure your slicer is connected too all relevant pivot tables and that you use the exact same field for your slicer and also for your filters
      further ensure that all pivot tables and slicer are based on the same connection
      can you try those steps – then it should work

      -gerhard

Leave a Reply