Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
Anonymous
Not applicable

Per Product 12-months' Rolling Average

Hi, 

 

I want to create a 12-months rolling average as a column in Power BI. I need it as a column as will need to then merge it to a different table.

If there are less than 12 months of data prior to the date then average whatever data is available.

Data is given on a monthly scale. 

Example, if I have this data:

ProductAnalysisMonthSales
AMar-1414
AMay-1411
AJun-1412
AMay-1521
AJun-1519
BApr-1411
BMay-1515
BJun-156

 

I want to get this view

ProductAnalysisMonth12-month Average Sales
AMar-1414
AMay-1425
AJun-1437
AMay-1533
AJun-1540
BApr-1411
BMay-1515
BJun-1521

 

Thanks

1 ACCEPTED SOLUTION
Anonymous
Not applicable

This worked for me for a column

VAR Product = Data[Product]

VAR CurrentDate = Data[AnalysisMonth]

VAR EarliestDate = DATE(YEAR(CurrentDate), MONTH(CurrentDate) - 12, DAY(CurrentDate))

 

RETURN

CALCULATE(

    SUM(Data[Sales]),

    FILTER(ALL(Data), Data[Product] = Product && EarliestDate < Data[AnalysisMonth] && Data[AnalysisMonth] <= CurrentDate)

)

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

This worked for me for a column

VAR Product = Data[Product]

VAR CurrentDate = Data[AnalysisMonth]

VAR EarliestDate = DATE(YEAR(CurrentDate), MONTH(CurrentDate) - 12, DAY(CurrentDate))

 

RETURN

CALCULATE(

    SUM(Data[Sales]),

    FILTER(ALL(Data), Data[Product] = Product && EarliestDate < Data[AnalysisMonth] && Data[AnalysisMonth] <= CurrentDate)

)

amitchandak
Super User
Super User

@Anonymous , if you have data and a separate date table, prefer separate product dimension too

 

then rolling like this should work

 

Rolling 12 = CALCULATE(sum(Sales[Sales]),DATESINPERIOD('Date'[Date ],MAX('Date'[Date ]),-12,MONTH))

 

Rolling Months Formula: https://youtu.be/GS5O4G81fww

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.