Hi Lynda - many thanks for all the wonderful lessons!
For a timeline I put based on dates from 01 Jan 2020 to 31 Dec 2020, it is also showing all the dates of 2021 as available for slicing. Is there any way to remove this?
Also - is there any way to get the end date of the selection (to analyze, say, the last five weeks' prior to that date)?
Thanks in advance!
Hi and welcome to our forum!
Unfortunately, there's no way to restrict the years displayed in the Timeline Slicer, nor is there an option to filter for the 'last n weeks', sorry.
Mynda
Hi Lynda - many many thanks for the swift response.
I'm not sure if I-explained / you-read properly. I don't want the 'last n weeks'. What I want - is the last date of the selection. For example, if the month of or till April is selected, what I'm looking for as a result is 30 April.
Re the years displayed, I don't understand why would it display a year that is not there in the source data!
The Timeline Slicer is a bit buggy. Sometimes it will show more years than you have data for, other times it will show the actual years. I haven't found a reason for when it does one or the other, but I've reported the bug to Microsoft.
That said, your issue might not be caused by the bug and as I haven't seen your file I wonder if your data originally had dates that extended past the current dates? These might still be in the Pivot Cache and the Timeline is picking these dates up. You can tell the Pivot Cache to forget data deleted from the source in the PivotTable Options > Data tab > in the 'Number of items to retain per field' select 'None'. Then refresh the PivotTable. Let me know if this fixes the problem.
You haven't said where you're expecting to see the 'result'. In the timeline, in the PivotTable?
Mynda
I had changed the 'Number of items to retain per field' setting to None, yes. I even copied the source to a new file and made a new Pivot. Didn't help.
The 'result' - I want in a cell so that I can use it in a formula.
Create a dummy PivotTable with just the date field in the value area. Set the aggregation to Maximum. Format the cell as date.
Mynda
Ingenious! Thank you!
Ok now I have a new problem 🙂
The value from the new dummy PivotTable helps automatically categorize the data in the source table. But for my chart to update, I have to make one of the PivotTables refresh automatically (to reflect these changes) as well.
I tried asking Dr. Google for a macro but all the results are based on changes to a cell value.
Could you write me the correct macro please?
The PivotTable doesn't sound like the best solution. If all you want to do is find the latest date in your source data, you can use INDEX&MATCH as explained here. This won't require any VBA and will automatically update.
Mynda
P.S. In future, please start a new thread so that the topic is related to the question.