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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
JLiljedahl
Helper I
Helper I

Rolling 12 month per month in a montly report

Hi,

 

I have a montly report where all data is filtered by a Slicer (e.g. 2024-12).

 

I have a measure that calculate Rolling 12M sales which for 2024-12 summarize Total sales for 2024-01 to 2024-12.

 

In this montly report I want to have a line chart that shows Rolling 12M per months the last 12 months which in above example show X-axis from 2024-01 to 2024-12 where 2024-01 summarizes sales from 2023-02 to 2024-01 (Rolling 12 at 2024-01)

 

Today, I try to use below DAX but this will only give me the value of 2024-12

 
Last12MonthsSales =
CALCULATE(
    [Total Sales],
    DATESINPERIOD('Date'[Date],max('Date'[Date]),-12,MONTH)
)

 

Anyone that could support?

 

2 ACCEPTED SOLUTIONS
anilelmastasi
Resolver III
Resolver III

Hello @JLiljedahl ,

 

Could you try this please?

 

Last12MonthsSales =
VAR CurrentDate = MAX('Date'[Date]) -- Get the current date in the context of the chart
RETURN
CALCULATE(
[Total Sales],
DATESINPERIOD('Date'[Date], CurrentDate, -12, MONTH) -- Rolling 12 months from each point on the X-axis
)

View solution in original post

Fowmy
Super User
Super User

@JLiljedahl 

It seems you need to be able to select a particular month and a chart to show past number of months, 12 in your case, check this video out: https://youtu.be/d8Rm7dwM6gc


Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

2 REPLIES 2
Fowmy
Super User
Super User

@JLiljedahl 

It seems you need to be able to select a particular month and a chart to show past number of months, 12 in your case, check this video out: https://youtu.be/d8Rm7dwM6gc


Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

anilelmastasi
Resolver III
Resolver III

Hello @JLiljedahl ,

 

Could you try this please?

 

Last12MonthsSales =
VAR CurrentDate = MAX('Date'[Date]) -- Get the current date in the context of the chart
RETURN
CALCULATE(
[Total Sales],
DATESINPERIOD('Date'[Date], CurrentDate, -12, MONTH) -- Rolling 12 months from each point on the X-axis
)

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

March2025 Carousel

Fabric Community Update - March 2025

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