Forum Discussion
Today less 12 months
Hi
I'm trying to build a report to show data for the last 12 months from today. I don't need any slicers just a screen showing the visuals.
I've tried using:
To get a dynamic rolling 12-month period ending today, you should adjust your DAX to explicitly use TODAY() instead of relying on MIN() or MAX() from the calendar, which are context-dependent. Here’s how you can rewrite your measure:
RollingTickets = CALCULATE( DISTINCTCOUNT(wh_task[task_id]), DATESBETWEEN( Calendar[Date], EDATE(TODAY(), -11), TODAY() ) )Explanation:
- TODAY() ensures the end date is always current.
- EDATE(TODAY(), -11) goes back 11 months, and since it includes the full current month, it results in a 12-month window.
Additional Tips:
- Ensure your Calendar[Date] column has a complete date range including today.
- This measure will auto-update as time progresses, perfect for static visuals without slicers.
Try this measure in your visual and confirm it shows the correct rolling 12-month count dynamically.
✔️ If my message helped solve your issue, please mark it as Resolved!
👍 If it was helpful, consider giving it a Kudos!
You can try
RollingTickets = CALCULATE ( DISTINCTCOUNT ( wh_task[task_id] ), DATESBETWEEN ( Calendar[Date], EDATE ( TODAY (), -11 ), TODAY () ) )You might want to use TODAY() - 1 in both instances, depending on when your data refreshes.
3 Replies
- SolomonovAnton
Super User
To get a dynamic rolling 12-month period ending today, you should adjust your DAX to explicitly use TODAY() instead of relying on MIN() or MAX() from the calendar, which are context-dependent. Here’s how you can rewrite your measure:
RollingTickets = CALCULATE( DISTINCTCOUNT(wh_task[task_id]), DATESBETWEEN( Calendar[Date], EDATE(TODAY(), -11), TODAY() ) )Explanation:
- TODAY() ensures the end date is always current.
- EDATE(TODAY(), -11) goes back 11 months, and since it includes the full current month, it results in a 12-month window.
Additional Tips:
- Ensure your Calendar[Date] column has a complete date range including today.
- This measure will auto-update as time progresses, perfect for static visuals without slicers.
Try this measure in your visual and confirm it shows the correct rolling 12-month count dynamically.
✔️ If my message helped solve your issue, please mark it as Resolved!
👍 If it was helpful, consider giving it a Kudos!
- johnt75
Super User
You can try
RollingTickets = CALCULATE ( DISTINCTCOUNT ( wh_task[task_id] ), DATESBETWEEN ( Calendar[Date], EDATE ( TODAY (), -11 ), TODAY () ) )You might want to use TODAY() - 1 in both instances, depending on when your data refreshes.
- micklowe
Helper I
SolomonovAnton johnt75 thanks guys, this works perfectly