# Get Timeline Slicer date range for inclusion in graph title



## LGXSteve (Oct 12, 2015)

I have a pivot table (derived from PowerPivot) that displays data filtered by a Timeline Slicer. The Pivot table is then represented in a Pie Chart which has a title. Is there any way I can link the title to the Timeline Slicer range, so it indicates the date range for which the pie chart is valid. I suspect some VBA may be required, but it is a v. long time since I did any VBA, and never with PowerPivot.

(I am using Excel 2013)

Thanks in anticipation


----------



## ImkeF (Oct 12, 2015)

How to harvest slicer values: Better Way to “Catch” Multiple Slicer Selections in a Formula - PowerPivotPro

How to connect the chart title to your cell: https://support.office.com/en-us/ar...0c62fca6f5?omkt=en-US&ui=en-US&rs=en-US&ad=US


----------



## santiazpi2 (Nov 30, 2019)

I prefer 2 simple vba functions:


```
Public Function TimelineStart(strTimelineName As String) As Date
    TimelineStart = ActiveWorkbook.SlicerCaches(strTimelineName).TimelineState.StartDate
End Function

Private Function TimelineEnd(strName As String) As Date
    TimelineEnd = ActiveWorkbook.SlicerCaches(strTimelineName).TimelineState.EndDate
End Function
```

You can get the slicer names from the names collection (Ctrl+F3)


----------



## kcmuppet (Sep 12, 2022)

I did it this way to avoid having to use any VBA:









						Excel: Creating Tables from Timeline Slicers - Strategic Finance
					

Use a disconnected pivot table to generate a worksheet title that always shows the dates selected for a Timeline slicer.



					sfmagazine.com
				




(Create a second copy of the pivot table; then make the 2nd pivot table display only the min and max dates from the dates field and use those in your formulae)


----------

