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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
arnabmit
Helper I
Helper I

Error in Rolling 12 month average

Hi,

 

I was trying to replicate Alberto Ferrari's method of Rolling 12 month average (Average of -13 to -1 month), but it is not matching with the manual calculation. Any idea why it is so?

 

My regular calendar table is _Calendar, and the disconnected calendar table with inactive relationship is '12m Cal'

Avg Rolling 12M = 
VAR RefDate = MAX(_Calendar[Date])
VAR PrevDates = 
    DATESINPERIOD(
        '12m Cal'[Date],
        EDATE(RefDate,-1),
        -12,
        MONTH
    )
VAR Result = 
    CALCULATE(
        DIVIDE([MTD],12),
        REMOVEFILTERS('_Calendar'),
        KEEPFILTERS(PrevDates),
        USERELATIONSHIP('12m Cal'[Date], _Calendar[Date])
    )
RETURN
    Result

Excel file 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@arnabmit , Check the suggestion from SpartaBI. Try like

 

12 Month Avg = CALCULATE(AverageX(Values('Date'[MONTH Year]),calculate(Sum('Table'[Value)))
,DATESINPERIOD('Date'[Date ],Eomonth(MAX('Date'[Date ])-1) ,-12,MONTH))

 

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

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@arnabmit , Check the suggestion from SpartaBI. Try like

 

12 Month Avg = CALCULATE(AverageX(Values('Date'[MONTH Year]),calculate(Sum('Table'[Value)))
,DATESINPERIOD('Date'[Date ],Eomonth(MAX('Date'[Date ])-1) ,-12,MONTH))

 

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
SpartaBI
Community Champion
Community Champion

@arnabmit I'm not sure why you have another disconnected calendar table. 
You can PM me and we can take a look together at your model in zoom if you want

It is as per Alberto Ferarri's method here https://www.youtube.com/watch?v=ACvYaXnpyCM

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.