cancel
Showing results 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

Helper II

## Rolling Average 12 Months

Hello,

I see a lot of questions on here about the rolling average however I cannot get any of them to work for my problem. I need a rolling 12 month average that is not affected by the slicer control (ie. not to reset at the start of the filtered table).

I need to SUM the last 12 months of [N2 Component] and Divide by the SUM of the last 12 months of [Total Sold]. To create a rolling 12 month average. I need it to go further than the selected dates in the slicer. Ie. Not to restart at July 2022, the July number should be July 2022 - Aug 2021. And should be blank if there is no data in the N2 or Total Sold

I have a separate Date Table. Unfortunately I cannot upload a sample of my files, only images - apologies! I hope someone can help, I feel like this is very simple, just can't get my head around it.

TIA 🙂

1 ACCEPTED SOLUTION
Helper II
5 REPLIES 5
Super User
Super User

Hi @JNelson ,
You can try out this example :-

Here are the steps you can follow：

1. Create measure.

``````Sum =
var _1=
IF(MAX([month])<>12,
CALCULATE(MAX('Table'[Month-Year]),FILTER(ALL('Table'),'Table'[Year]=MAX('Table'[Year])-1&&'Table'[month]=MAX('Table'[month])+1)),
DATE(YEAR(MAX([Month-Year])),1,1))

var _2=
CALCULATE(
SUM('Table'[Value]),
FILTER(ALL('Table'),[Month-Year]>=_1&&[Month-Year]<=MAX([Month-Year])))
return _2``````
``````Sum/12 =
var _1=
IF(MAX([month])<>12,
CALCULATE(MAX('Table'[Month-Year]),FILTER(ALL('Table'),'Table'[Year]=MAX('Table'[Year])-1&&'Table'[month]=MAX('Table'[month])+1)),
DATE(YEAR(MAX([Month-Year])),1,1))

var _2=
CALCULATE(
SUM('Table'[Value]),
FILTER(ALL('Table'),[Month-Year]>=_1&&[Month-Year]<=MAX([Month-Year])))
return _2/12``````

Thanks ,
Pratyasha Samal
Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.

Proud to be a Super User!

Helper II
Helper II

Can you please describe how the calendar table should look? I'm a bit confused with the [Month] [Month-Year] [Year] measures you're referring to? Should I split my date column out into those three?

Thanks

Super User

Hi @JNelson ,
Yes you can add 3 columns .
https://hevodata.com/learn/power-bi-calendar-table/

Thanks ,
Pratyasha Samal
Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.

Proud to be a Super User!