Make Excel Power Pivot Measures Dynamic by Month
Question details
Make Power Pivot measures respond to a selected month without manually changing period codes.

- Product
- Microsoft Excel Power Pivot
- Device & OS
- not provided
- Scenario
- Period codes such as A2210 and B2210 change as the reporting month changes.
- Observed behavior
- Measures use hard-coded period codes that must be edited for each new month.
Check that Power Pivot is available in your Excel edition and identify the table, amount column, and period-code column used by your measures. The example below assumes codes consist of a one-character prefix followed by a two-digit year and two-digit month.
Use a month column and slicer to filter Power Pivot measures
Select a reporting month in the PivotTable instead of editing period codes in each measure.
A month column gives the data model a common value for codes such as A2210 and B2210. A slicer can filter that column, and measures respond through the PivotTable's filter context.
INDIRECT is an Excel worksheet function, not a DAX function. A measure cannot directly read an arbitrary worksheet cell; a worksheet selection must be loaded into the model or applied through a PivotTable filter.
In Excel, open the Power Pivot tab and select Manage. In Data View, select the table containing your period codes.
Select Add Column and enter =DATE(2000 + VALUE(MID([PeriodCode], 2, 2)), VALUE(RIGHT([PeriodCode], 2)), 1). Replace PeriodCode with your actual column name, then name the new column PeriodMonth. For example, A2210 and B2210 both produce October 1, 2022.
In Power Pivot, edit the measure to remove the hard-coded month code. For example, use =SUM(Sales[Amount]), replacing Sales and Amount with your table and column names. Keep any other filters your calculation requires.
Return to the PivotTable, select PivotTable Analyze > Insert Slicer, and choose PeriodMonth. Select the desired month in the slicer; the measure will calculate for rows in that month.
Select October 2022 in the slicer and compare the result with the source rows for A2210 and B2210. If a measure should include only one prefix, retain a separate prefix filter in that measure.

Work with monthly spreadsheets in WPS Office
WPS Office is a free, lightweight alternative with a familiar spreadsheet interface and Microsoft Office format compatibility, making it easy to move everyday spreadsheet work. It does not repair Excel Power Pivot or replace its data-model measures.

Frequently Asked Questions
Can a Power Pivot measure use INDIRECT to read a worksheet cell?
No. INDIRECT is a worksheet function, not a DAX function, and a DAX measure cannot directly read an arbitrary worksheet cell. Load a selection table into the data model or use a PivotTable slicer to apply the selected month.
How can a measure always use the current month?
With the example PeriodMonth column, a measure can use =CALCULATE(SUM(Sales[Amount]), FILTER(ALL(Sales[PeriodMonth]), Sales[PeriodMonth] = DATE(YEAR(TODAY()), MONTH(TODAY()), 1))). Replace the table and column names, and refresh or recalculate the model as needed.
Will the month slicer include both A and B period codes?
Yes, if both codes map to the same PeriodMonth and no other filter excludes either prefix. Add or retain a separate prefix filter if a measure should include only A or only B.
What if my period codes use a different format?
Adjust the calculated-column formula in Power Pivot to match the position and length of the year and month in your codes. Check the resulting dates against the source data before using the column in a slicer.




