Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for a $400 discount.
Register nowGet inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.
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
Anyone that could support?
Solved! Go to Solution.
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
)
@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
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
@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
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
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
)
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!
Check out the February 2025 Power BI update to learn about new features.
User | Count |
---|---|
86 | |
71 | |
68 | |
50 | |
30 |
User | Count |
---|---|
119 | |
101 | |
73 | |
65 | |
40 |