Pivot Table Issues

Return Latest-Date Inventory in an Excel Power PivotTable

Steve KSteve K Nov 12, 2026 868 views

Question details

Return the inventory value recorded on the latest available date, rather than returning the highest inventory number.

Return Inventory for the Latest Date in an Excel Power PivotTable
Product
Microsoft Excel Power Pivot and PivotTable
Device & OS
not provided
Scenario
The user is building a PivotTable from a Power Pivot data model and needs an inventory measure that follows the current report filters.
Observed behavior
Using MAX on the inventory field returns the largest inventory value instead of the inventory associated with the most recent date.
Before you start

Confirm that the source table includes a valid Date column and an Inventory column, and that both are loaded into the Excel Data Model. Decide whether inventory values on the latest date should be summed, averaged, or otherwise aggregated when multiple records exist.

Solution 1Recommended

Create DAX measures for the latest date and its inventory value

Use this method when your PivotTable is based on the Excel Power Pivot Data Model and must remain reliable after Power Query refreshes or layout changes.

Create measures in the data model instead of referencing a fixed PivotTable cell. The first measure finds the latest date within the current filter context, while the second returns inventory only for that date.

The example below sums inventory when more than one source row exists for the latest date. Replace SUM with another aggregation if your data requires a different result.

1
Open the Power Pivot window

In Excel, select the Power Pivot tab and click Manage to open the Data Model. If the tab is unavailable, enable the Microsoft Power Pivot for Excel COM Add-in from File > Options > Add-ins.

2
Create a latest-date measure

In the calculation area for your inventory table, create a measure such as: Latest Inventory Date := MAX(Inventory[Date]). Replace Inventory with the actual name of your data table.

3
Create the inventory-at-latest-date measure

Create a second measure such as: Inventory at Latest Date := VAR LatestDate = [Latest Inventory Date] RETURN CALCULATE(SUM(Inventory[Inventory]), REMOVEFILTERS(Inventory[Date]), Inventory[Date] = LatestDate). This retains filters such as product or warehouse while evaluating inventory on the identified latest date.

4
Add the final measure to the PivotTable

Return to the PivotTable Fields pane, expand the data table, and drag Inventory at Latest Date into the Values area. Use this measure rather than a worksheet formula that points to a PivotTable cell.

Create DAX measures for the latest date and its inventory value
Refresh-resistant result: Because the result is calculated in the Data Model, it continues to work when Power Query refreshes the source or the PivotTable moves and changes layout.
Free Microsoft Office alternative

Use WPS Office for Everyday Excel-Compatible Inventory Reports

Power Pivot Data Model measures are a Microsoft Excel-specific feature. For everyday inventory spreadsheets, PivotTables, formulas, and report sharing, WPS Office provides a free, lightweight alternative with a familiar spreadsheet interface and smooth migration from existing Excel files.

Create and analyze inventory reports with WPS Spreadsheets PivotTables and formulas.Open, edit, and save Microsoft Excel .xlsx and .xls inventory workbooks.Use a familiar ribbon-style interface for a faster transition from Microsoft Office.Share lightweight spreadsheet files without changing common workbook layouts.
microsoft office alternative - wps office

Frequently Asked Questions

Why does MAX return the wrong inventory value in my PivotTable?

MAX(Inventory[Inventory]) evaluates the inventory column and returns its highest numeric value. To return inventory for the latest date, first calculate MAX(Inventory[Date]) and then calculate inventory with the Date column filtered to that result.

Where do I create a Power Pivot measure in Excel?

Select Power Pivot > Manage, choose the table in the Data Model, and enter the DAX expression in the calculation area at the bottom of the table. The measure will then appear in the PivotTable Fields pane.

Will the latest-date inventory measure respect warehouse and product filters?

Yes. The measure can preserve filters for fields such as warehouse, product, or category while removing and replacing only the filter on Inventory[Date]. The latest date is therefore determined within the current PivotTable context.

What happens if there are multiple inventory records on the latest date?

The sample measure uses SUM(Inventory[Inventory]), so it adds all matching inventory records for that date. Change SUM to MAX, MIN, AVERAGE, or another appropriate aggregation if your source data has a different business rule.