Forum Discussion

Vedicine's avatar
Vedicine
Copper Contributor
Jan 26, 2023

Connecting two timelines from two different pivot tables that have different data sources

Hi

I have created two pivot tables from two different data sources. 
These data sources have one thing in common which is that both have column with date.

 

I want to have one "master" timeline that would control both pivot tables.

 

I am assuming I would need to create VBA module to control it. I got myself that far (code below), but it doesn't work. I get no error, but whenever I change date range on timeline "Data", which is supposed to be a this "Master" timeline, the date range on timeline "Data1" doesn't change 😞

 

 

 

 

Sub UpdateTimelineDate()
    Dim selectedRange As Range
    ' Get the selected date range on timeline "Data"
    Set selectedRange = ActiveWorkbook.TimelineViews("Data").Range
    ' Apply the selected date range to timeline "Data1"
    ActiveWorkbook.TimelineViews("Data1").RangeStart = selectedRange.Start
    ActiveWorkbook.TimelineViews("Data1").RangeEnd = selectedRange.End
End Sub

 

 

 

 

8 Replies

    • NikSat's avatar
      NikSat
      Copper Contributor
      How did you add the date Hierarchy to the calendar table, and what was the purpose?
      • Riny_van_Eekelen's avatar
        Riny_van_Eekelen
        Platinum Contributor

        NikSat When I added Table1 and Table2 to the DM, I clicked 'Date Table' on the Design tab in the Calendars group. That automatically created the Calendar table based on the dates found in other tables, including the hierarchy. 

        And you can update/adjust the date range if you want/need.

        But the key is that you create a table containing unique dates that cover all dates in the model, and that you use the date column from the Calendar table when you create pivot tables.

         

    • NikSat's avatar
      NikSat
      Copper Contributor
      Hi Vedicine,

      Even I am currently facing the similar issue, did you find of the solution of this problem??

Resources