Forum Discussion

angelo2022's avatar
angelo2022
Frequent Visitor
4 years ago
Solved

Problem with Running Totals for Prior Year

Hi,  I'm struggling with the DAX to calculate the running total for the Prior Year.   The Running total for the current Financial year works fine though.     To get this working I have Two date ta...
  • amitchandak's avatar
    4 years ago

    angelo2022 , Try like example

     

    Last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-1,Year),"6/30"))

     

    or

     

    new column

    Day of Year =datediff([Year Start date] , [Date],Day) +1

     

    measures

    YTD= CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Year Rank]=max('Date'[Year Rank]) && 'Date'[Day of Year] <= Max('Date'[Day of Year]) ))
    LYTD = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Year Rank]=max('Date'[Year Rank])-1 && 'Date'[Day of Year] <= Max('Date'[Day of Year])))

     

    Time Intelligence, DATESMTD, DATESQTD, DATESYTD, Week On Week, Week Till Date, Custom Period on Period,
    Custom Period till date: https://youtu.be/aU2aKbnHuWs&t=145s