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
maurcoll
Helper II
Helper II

Rolling 12 month total

Hi

I am trying to calculate the last rolling 12 months data that i can put into a line chart visual.

It will need to show monthly going back for 12 months as per the below data. So for Sept 23 it will show the sum of data for the October 22 - Sept 23. August 23 will show data for Sept 22 - Aug 23 and so on.

 

TotalMonthYearRolling 12 months
4001/01/2022 
7801/02/2022 
13601/03/2022 
27501/04/2022 
36001/05/2022 
46301/06/2022 
52201/07/2022 
61201/08/2022 
68701/09/2022 
76101/10/2022 
83801/11/2022 
88701/12/20225659
90601/01/20236525
95101/02/20237398
97401/03/20238236
90801/04/20238869
88001/05/20239389
87601/06/20239802
89001/07/202310170
88701/08/202310445
88101/09/202310639
 
This is the calculation i am using but it is showing monthly totals on the chart not the cumulated 12 month total.
Rolling 12 Months =
CALCULATE(
    SUM( Total[Total]),
    DATESINPERIOD( Date[MonthYear], MAX( Date[MonthYear] ), -12,  MONTH )
1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

PBI file attached.

Hope this helps.

Ashish_Mathur_0-1702701820998.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

3 REPLIES 3
Ashish_Mathur
Super User
Super User

Hi,

PBI file attached.

Hope this helps.

Ashish_Mathur_0-1702701820998.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
ThxAlot
Super User
Super User

ThxAlot_0-1702671721661.png



Expertise = List.Accumulate(


        {Days as from Today},


        {Skills and Knowledge},


        (Current, Everyday) => Current & Day.LeanAndPractise(Everyday)


)



jgeddes
Super User
Super User

A measure like the following might work for you...

rollingTotalMeasure =
var _rollingMonths =
12
var _maxDate =
MAXX(
    ALL('Table'),
    [MonthYear]
)
Return
CALCULATE(
    SUM('Table'[Total]),
    FILTER(
        ALL('Table'),
        [MonthYear] <= MAX('Table'[MonthYear]) && DATEDIFF([MonthYear], _maxDate, MONTH) < _rollingMonths
    )
)



Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

Check out the June 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.

Top Solution Authors