Forum Discussion
12 M rolling per customer
Dear All, I have this dataset bellow (filtered per customer)
I am trying to create a column where the cumulated sales YTD starting from last year date, so there will be a total of sales from last 12 months. I have tried some formulas, but somehow I can't succeed where I am looking for.
In column 12M I have added formula:
Anonymous you should be adding these as measures not columns.
Anonymous , Not sure I get it completely
Is this a date table 'dDate Sales' ? and this the date column in date table [Month+Year] ?
Example of rolling 12 M with Dat calendar
Rolling 12 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date],ENDOFMONTH(Sales[Sales Date]),-12,MONTH)) Rolling 12 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date ],MAX(Sales[Sales Date]),-12,MONTH))To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/
See if my webinar on Time Intelligence can help: https://community.powerbi.com/t5/Webinars-and-Video-Gallery/PowerBI-Time-Intelligence-Calendar-WTD-YTD-LYTD-Week-Over-Week/m-p/1051626#M184
Appreciate your Kudos.
4 Replies
- parry2k
Super User
Anonymous you should be adding these as measures not columns.
- AnonymousNot applicable
Hi parry2k,
Thanks for the feedback, I'll try with a measure.
Do you know what formula I should use in this Measure?
Thanks!
- amitchandak
Super User
Anonymous , Not sure I get it completely
Is this a date table 'dDate Sales' ? and this the date column in date table [Month+Year] ?
Example of rolling 12 M with Dat calendar
Rolling 12 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date],ENDOFMONTH(Sales[Sales Date]),-12,MONTH)) Rolling 12 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date ],MAX(Sales[Sales Date]),-12,MONTH))To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/
See if my webinar on Time Intelligence can help: https://community.powerbi.com/t5/Webinars-and-Video-Gallery/PowerBI-Time-Intelligence-Calendar-WTD-YTD-LYTD-Week-Over-Week/m-p/1051626#M184
Appreciate your Kudos.- AnonymousNot applicable