DAX code
Rolling 3-Month Sales =
-- Sums the 3 months ending on the last date visible in the current filter context
CALCULATE(
[Total Sales],
DATESINPERIOD('Date'[Date], LASTDATE('Date'[Date]), -3, MONTH)
)
Sums sales over the 3 months ending on the latest date in the current context.
Type your table and column names once. Every measure below updates.
Rolling 3-Month Sales =
-- Sums the 3 months ending on the last date visible in the current filter context
CALCULATE(
[Total Sales],
DATESINPERIOD('Date'[Date], LASTDATE('Date'[Date]), -3, MONTH)
)
Generate a Power BI date table
Change -3 to any window length. Requires a marked, gap-free Date table so LASTDATE resolves correctly.
Browse all 175 measures in the Power BI DAX Measures Library, or search the library for something similar to Rolling 3-Month Sales.