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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
maurcoll
Helper I
Helper I

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
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.