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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Rolling 12 Month Help

Thank you to all who reply.

 

I would like to see the rolling months from 2017 - 2021.  See below.  

 

Invoiced Sales rolling 12 mth =
CALCULATE(
[Invoiced Sales],
FILTER (
ALL('salesMaster'),
AND (
'salesMaster'[yearMonth] <= MAX ('salesMaster'[yearMonth]),
DATEADD (
'salesMaster'[yearMonth],
36,
MONTH
) > MAX ( 'salesMaster'[yearMonth] )
)
)
)
 
The first 2 years(2017,2018) worked perfectly but starting with 2/1/2019 it stopped. See tables below.
 
BLD65_0-1647870705884.png

I also tried increasing the number of months. 

 

Any ideas?

 

Thank you,

BLD

 
**SOLVED - I used my Date table instead and the calcuations now work. 
My next question is there a way to use a slicer for the dates to see maybe midway thru one month to the next year. Example:  3/2017 to 2/2018??
 
 
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , select a date from date tbale, you should be get rolling data

 

example

Rolling 12 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date ],MAX('Date'[Date ]),-12,MONTH))

 

but if you select one date and want to display 12 months on axis ,then you need independent date table

 

//Date1 is independent Date table, Date is joined with Table
new measure =
var _max = maxx(allselected(Date1),Date1[Date])
var _min = eomonth(_max, -12) +1
return
calculate( sum(Table[Value]), filter('Date', 'Date'[Date] >=_min && 'Date'[Date] <=_max))

 

Need of an Independent Date Table:https://www.youtube.com/watch?v=44fGGmg9fHI

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

1 REPLY 1
amitchandak
Super User
Super User

@Anonymous , select a date from date tbale, you should be get rolling data

 

example

Rolling 12 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date ],MAX('Date'[Date ]),-12,MONTH))

 

but if you select one date and want to display 12 months on axis ,then you need independent date table

 

//Date1 is independent Date table, Date is joined with Table
new measure =
var _max = maxx(allselected(Date1),Date1[Date])
var _min = eomonth(_max, -12) +1
return
calculate( sum(Table[Value]), filter('Date', 'Date'[Date] >=_min && 'Date'[Date] <=_max))

 

Need of an Independent Date Table:https://www.youtube.com/watch?v=44fGGmg9fHI

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.