VBA to connect timeline filter with data slicer month filter of another pivot

carid

New Member
Joined
May 29, 2022
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Hello. I have two different tables with pivot tables (in the data model) and pivot charts. One has dates and a timeline slicer. The other has only months. The goal is to connect the timeline from one pivot to the months filter of the other. Can you suggest a vba macro (running as private sub maybe) that recognises the timeline selections and applies them either as filter on the "months" column, or as selections in a hidden "months" data slicer?

I can go as far as detecting the two months selected in the timeline:
frommonth = Month(ActiveWorkbook.SlicerCaches("Timeline_Date").TimelineState.FilterValue1)
tomonth = Month(ActiveWorkbook.SlicerCaches("Timeline_Date").TimelineState.FilterValue2)

How can I then select those months and all months in between in the second pivot?

((If there is a way to avoid vba, thats also fine, however, I could not make the months column work with timeline slicer no matter how I formatted it. Neither did it work to add a third table with dates and months and try to connect the timeline with this and another slicer between the new table and the months one.))

This is an annual spreadsheet so its only for 2022, dates in the timeline are from 01.01.2022 - 31.12.2022.

Thank you!
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.

Forum statistics

Threads
1,224,744
Messages
6,180,697
Members
452,994
Latest member
Janick

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top