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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
OhLookAnError
Helper I
Helper I

Rolling trailing 12 month average

Hey everyone, this seems simple and I have got it to work before but I cant seem to get it to work in this case. 

 

I just need the line to be the average of the last 12 months at each column point if that makes sense. I treid a measure I have used before with success although I previously used it as days not months and I tried a measure I found on here that was for someone else that had the same question. below is the two measures I have tried and screenshots below. 

 

T12m Sales $'s =

     VAR NUMMONTHS = 12

     VAR ROLLINGSUM =
                      Calculate(
                      SUM('Sales'[Sales]),
                      DATESINPERIOD('Sales'[Date],
                      LASTDATE('Sales'[Date]), - NUMMONTHS, MONTH))
    RETURN
    ROLLINGSUM/NUMMONTHS
 
Sales12M = CALCULATE ('Sales'[T12m Sales $'s],
    DATESBETWEEN (
        'Sales'[Date],
        NEXTDAY ( SAMEPERIODLASTYEAR ( LASTDATE ( 'Sales'[Date] ) ) ),
        LASTDATE ( 'Sales'[Date] )
    )
)
 
 
 
OhLookAnError_0-1702995842580.pngOhLookAnError_1-1702995877831.png

 

Thanks in advance! 
2 REPLIES 2
Anonymous
Not applicable

Hi @OhLookAnError ,

 

Based on the information you provided, I am not sure what kind of error you encountered during the process. What is your reported error, can you attach a screenshot of the error or provide a pbix file without privacy?

 

Here is the version of my Power BI Desktop:

vyifanwmsft_0-1703057323987.png

 

 

Below is the screenshot and pbix file of my reproduction:

 

vyifanwmsft_1-1703057323991.png

 

 

How to Get Your Question Answered Quickly - Microsoft Fabric Community

If it does not help, please provide more details with your desired out put and pbix file without privacy information.

 

Best Regards,

Yifan Wang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks for the response! To clarify, I am not getting an error, it just isnt returning the avaergae of the prior 12 months. The value just goes up and down correlating directly to each month instead slighter changes to represent the average. 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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.