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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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
v-yifanw-msft
Community Support
Community Support

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
July 2024 Power BI Update

Power BI Monthly Update - July 2024

Check out the July 2024 Power BI update to learn about new features.

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.