The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Hi friends,
I am trying to create Rolling 13 months sum using DAX and I am looking for some help around it.
This is my data set. And I want to create a measure and not a column which gives me Rolling 13 months sale for the month I select in the filter.
Data Set:
Month Year | Sale |
Apr-21 | 1000 |
May-21 | 200 |
Jun-21 | 3000 |
Jul-21 | 1200 |
Aug-21 | 1500 |
Sep-21 | 1600 |
Oct-21 | 1300 |
Nov-21 | 2000 |
Dec-21 | 1000 |
Jan-22 | 2000 |
Feb-22 | 3000 |
Mar-22 | 1000 |
Apr-22 | 1000 |
May-22 | 2000 |
Jun-22 | 1000 |
Result Expected:
Month Year | Rolling 13 Month Sale |
Apr-22 | 19800 |
May-22 | 20800 |
Jun-22 | 21600 |
Thanks
Solved! Go to Solution.
Hi @Anonymous ,
This measure below will work if you have a date column in your table. It won't work if you have only the month name as it is a text.
Measure =
CALCULATE(
SUM( 'Table'[Sale] ),
DATESINPERIOD( 'Table'[DateRef], MAX( 'Table'[DateRef] ), -13, MONTH )
)
Proud to be a Super User!
Hi,
You may download my PBI file from here.
Hope this helps.
Hi,
You may download my PBI file from here.
Hope this helps.
Hi,
You may download my PBI file from here.
Hope this helps.
Thanks Ashish for your help and time.
You are welcome.
Hi @Anonymous ,
This measure below will work if you have a date column in your table. It won't work if you have only the month name as it is a text.
Measure =
CALCULATE(
SUM( 'Table'[Sale] ),
DATESINPERIOD( 'Table'[DateRef], MAX( 'Table'[DateRef] ), -13, MONTH )
)
Proud to be a Super User!
Hi mate, thans for your time and help, it worked.
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
User | Count |
---|---|
110 | |
82 | |
63 | |
53 | |
51 |
User | Count |
---|---|
127 | |
118 | |
81 | |
65 | |
64 |