Pivot Table Issues

How to Automatically Select the Latest Month in an Excel PivotTable Chart

Maira MehtabMaira Mehtab Oct 29, 2026 869 views

Question details

The user wants to configure an Excel PivotTable and its associated waterfall chart to automatically update and select the most recent month's data after a refresh, particularly when using calculated fields.

How to Automatically Select the Latest Month in an Excel PivotTable Chart
Product
Excel
Device & OS
not provided
Scenario
Creating a dynamic waterfall chart based on PivotTable data that requires pulling the latest month automatically after a data refresh.
Observed behavior
Currently, the month in the chart table is static (e.g., fixed to June 2021) and does not automatically update to the newest month when new data is added and the PivotTable is refreshed.
Before you start

Ensure your PivotTable source data is formatted as an Excel Table so that new rows are automatically included during a refresh, and verify that your month column contains valid numerical dates rather than text.

Solution 1Recommended

Use MAX and GETPIVOTDATA Formulas to Build a Dynamic Chart Table

Extract the most recent month from your source table using the MAX function and feed it into GETPIVOTDATA to dynamically populate your chart.

Standard PivotCharts may struggle to automatically filter for the 'latest month' when utilizing calculated fields like Gross Profit or Net Profit, as these fields do not exist as standard categories in the source data. The most robust workaround is to build a separate chart data table driven by formulas.

1
Find the latest month in the source data

Create a helper cell outside your PivotTable. Enter the formula =MAX(Table1[Month]) (replace 'Table1' and 'Month' with your actual table and column names) to automatically calculate the most recent date.

2
Link the helper cell to your chart table

In the separate table that drives your waterfall chart, reference the helper cell containing the latest month. This ensures your column header or month reference updates dynamically.

3
Extract data using GETPIVOTDATA

In the data cells of your chart table, use the GETPIVOTDATA function referencing the dynamic month cell. For example: =GETPIVOTDATA("Amount", $M$1, "Month", P$9, "Category", M11) where P$9 is your dynamic month cell and M11 is your category.

4
Refresh your PivotTable

When new data is added to your source table, navigate to the 'PivotTable Analyze' tab and click 'Refresh'. The helper cell will grab the new maximum month, and the GETPIVOTDATA formulas will instantly pull the updated data into your chart.

Use MAX and GETPIVOTDATA Formulas to Build a Dynamic Chart Table
Calculated Fields Supported: This method works perfectly for calculated fields because GETPIVOTDATA extracts the calculated results directly from the active PivotTable structure without requiring them to be in the original source dataset.

Create Dynamic PivotTables and Charts in WPS Spreadsheet

WPS Spreadsheet offers powerful PivotTable capabilities, complete support for advanced extraction formulas like GETPIVOTDATA, and dynamic charting tools to handle complex financial data efficiently.

  1. 1. Insert a PivotTable: Open your dataset in WPS Spreadsheet, go to the 'Insert' tab, and click 'PivotTable' to summarize your source data.
  2. 2. Set up your dynamic formulas: Use the =MAX() function in a helper cell to find the latest month, then build your chart data range utilizing the =GETPIVOTDATA() function linked to your PivotTable.
  3. 3. Insert the Waterfall Chart: Highlight your newly created dynamic data range, navigate to 'Insert' > 'Chart', and select the Waterfall Chart type.
Fully compatible with Microsoft Excel (.xlsx) formats and advanced formulas.Robust PivotTable features with seamless data refreshing capabilities.Supports dynamic functions like GETPIVOTDATA and MAX for automated reporting.Free, lightweight, and features an intuitive tabbed interface for easy data management.
microsoft office alternative - wps office

Frequently Asked Questions

Why does my GETPIVOTDATA formula return a #REF! error?

A #REF! error typically occurs if the specific data point you are trying to extract is hidden or filtered out in the PivotTable, or if the field names used in the formula do not exactly match the field headers in your PivotTable.

Can I use the MAX function if my month column is formatted as text?

No, the MAX function requires numerical values or valid date serial numbers to work. If your months are formatted as text strings (e.g., 'Jan', 'Feb'), you will need to add a helper column to your source data that converts those text strings into date values before applying the MAX function.

Why doesn't my waterfall chart update immediately when I paste new data?

PivotTables and GETPIVOTDATA formulas do not update in real-time when source data changes. You must manually instruct the software to update by going to the Data tab and clicking 'Refresh All' so the PivotTable recognizes the new rows.

Is there a way to auto-refresh the PivotTable without manually clicking refresh?

You can configure the PivotTable to refresh automatically when the file is opened by right-clicking the PivotTable, selecting 'PivotTable Options', navigating to the 'Data' tab, and checking 'Refresh data when opening the file'.