• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Pivot table Timelines

Len Agnor

New Member
I just upgraded to Excel 2013 and started using timelines. Is there any way to use the choice of dates in another field? For instance, if I choose July in my timeline, could I use that in a title field, "For the month ending July 31, 2016"?
 
The value I am referring to is the month chosen on the timeline. For instance if I click on July or August or June-August the pivot table will return all values matching this data. I am just wondering if excel stores that choice (July) in a variable that could be referenced on the worksheet.
 
Not without VBA.

For an example if you select "June" you can see start date with following.

Code:
    Debug.Print ActiveWorkbook.SlicerCaches("NativeTimeline_Date"). _
        TimelineState.FilterValue1

Which will return "6/1/2016". End date is .FilterValue2 and will return "6/30/2016" in this case.

These values can be set via code in following manner.

Code:
    ActiveWorkbook.SlicerCaches("NativeTimeline_Date").TimelineState. _
        SetFilterDateRange "8/1/2016", "9/30/2016"

If you have more than 1 Timeline, "NativeTimeline_Date#" will be the name. Where # is sequential number starting at 1.
 
Back
Top