Forum

Controlling multipl...
 
Notifications
Clear all

Controlling multiple pivot tables (separate cache) with one slicer

15 Posts
4 Users
0 Reactions
266 Views
(@blankab)
Posts: 63
Estimable Member
Topic starter
 

As far as I know you can filter multiple pivot tables with one slicer only if the pivot tables share the cache.

I have one big source of data which I have to group and distinct count by various fields, which I'm doing with separate queries in Power Query. Because of this, I ended up with separate pivot tables.

I believe that the only way I can filter these multiple pivot tables with one slicer is with a help of a macro, but I'm not VBA savvy at all.

I would be very grateful for ideas.

Thank you,

Blanka

 
Posted : 20/12/2016 5:06 pm
(@db325)
Posts: 19
Active Member
 

Perhaps the following will help:

http://www.jkp-ads.com/Articles/slicers04.asp

If you want to start learning VBA, have a look at the links in Post #9 in the following:

http://www.mrexcel.com/forum/excel-questions/910633-learning-visual-basic-applications.html

 
Posted : 22/12/2016 7:22 am
(@blankab)
Posts: 63
Estimable Member
Topic starter
 

Thank you, Derek.

I was hoping it would be easier and simpler. I started reading the first article and my head is spinning. I'll have to try and play around with it.

Thank you again.

 
Posted : 22/12/2016 7:11 pm
(@blankab)
Posts: 63
Estimable Member
Topic starter
 

I adapted the macro from the first link posted by Derek and it works, just extremely slowly and freezes up the workbook. It synchronizes all the slicers/pivot tables in the workbook, but it takes a good minute or two each time a slicer button is clicked. I'm afraid my end users will not be happy.

Any ideas how to speed it up?

Thanks you so much, again.

 
Posted : 23/12/2016 2:33 pm
(@db325)
Posts: 19
Active Member
 

My first suspicion would be Excel calculation taking place (probably main times as changes are made).

Try:

Application.Calculation = xlCalculationManual

at the beginning of the code and

Application.Calculation = xlCalculationAutomatic

at the end.

 
Posted : 23/12/2016 2:52 pm
(@blankab)
Posts: 63
Estimable Member
Topic starter
 

Derek,

Much better. The wait time went down to about 15-20 seconds.

Does it matter exactly where the "Application.Calculation" lines go? Should the Manual go right after the variable declarations, and the Automatic one right before the End Sub?

I appreciate your help.

Blanka

 
Posted : 23/12/2016 5:30 pm
(@db325)
Posts: 19
Active Member
 

In the jkp-ads example, there is a "Application.ScreenUpdating" line. I would put after it (at the beginning of the procedure) and before it at the end of the procedure. You can of course add code to do the recalculation should that be necessary.

I tend to declare all my variables first (alphabetically to make maintenance easier), then in most cases the "Application" code (e.g. ScreenUpdating, Calculation, EnableEvents) goes next. The order in which these appear depend on what I am trying to do. The "Application" code at the end of the procedure will be in reverse order to the way it was written at the beginning (e.g. EnableEvents, Calculation, ScreenUpdating).

 
Posted : 24/12/2016 8:15 am
(@blankab)
Posts: 63
Estimable Member
Topic starter
 

Many thanks, Derek.

I did as instructed by you and now the wait time went down to about 8-10 seconds on average. Not ideal, but my end users may have to learn to live with this.

Thank you again.

 
Posted : 30/12/2016 2:48 pm
(@db325)
Posts: 19
Active Member
 

It may not be relevant in this case but if the workbook is being opened on a network drive, that would increase the running time.

In my last job I created an automation process that I recommended was run on the C: drive. If run on a network drive the run times would increase by a factor of around 10.

 
Posted : 30/12/2016 4:40 pm
(@blankab)
Posts: 63
Estimable Member
Topic starter
 

Yes, unfortunately the file must reside on the network. Recently we moved to Virtual Desktop and nobody in the office has a real C: drive as far as I know.

 
Posted : 04/01/2017 10:50 am
(@db325)
Posts: 19
Active Member
 

Are you likely to have more than one workbook open at the same time?

If so, the following may be of interest:

https://msdn.microsoft.com/en-us/library/office/ff700515(v=office.14).aspx

If the workbook has a lot of conditional formatting, that may affect calculation speed.

 
Posted : 04/01/2017 12:55 pm
(@blankab)
Posts: 63
Estimable Member
Topic starter
 

This made for interesting reading; thank you for the link.

Not much conditional formatting going on in my workbook, but I finally decided to go a different route. I created and merged more queries in Power Query, so now I'm able to have it all in one pivot table and same cache. It takes a longer time to update the workbook with the new data, but I can deal with this as it happens only once a month and I'm the only one affected. My users now are able to work with the dashboards at a quick pace.

Thank you for all your help.

 
Posted : 07/01/2017 6:30 pm
(@mynda)
Posts: 4761
Member Admin
 

Great news, Blanka. Glad you have a workable solution and even better that Power Query was useful.

 
Posted : 07/01/2017 8:20 pm
(@db325)
Posts: 19
Active Member
 

Thank you very much for the feedback.

I am very pleased that you have been able to get a good solution to the problem. Well done!

 
Posted : 08/01/2017 4:40 am
(@catalinb)
Posts: 1937
Member Admin
 

Hi Blanka,

Glad to hear you managed to make it work.

Just a minor observation: Can you please mark the relevant answers in this topic? Each message has a "Useful Answer" link below the message text, to help other visitors identify more easily the solution they are hunting for, so it will be a great help for them.

Thanks

 
Posted : 12/01/2017 5:29 am
Share: