Forum Discussion

micklowe's avatar
micklowe
Icon for Helper I rankHelper I
1 year ago
Solved

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:

RollingTickets = CALCULATE(DISTINCTCOUNT(wh_task[task_id]),DATESBETWEEN(Calendar[Date],EDATE(MIN(Calendar[Date]),-11),MAX(Calendar[Date])))
 
But this gives me the end of the year as the end date so it always shows the current years figures.
 
Anyone know if this is possible?
 
Thanks
Mick
  • 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

  • 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.