Forum Discussion

Mkobayashi's avatar
Mkobayashi
New Member
2 years ago
Solved

YTD Over Years

Hello everyone,   I have something like this today, it's a simples TOTALYTD measure. however what i want is the current YTD over years, for example:   however what i want is the current YTD...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi All
    Firstly  Ashish_Mathur and lbendlin thank you for yours solutions!
    And Mkobayashi ,As I understand it, you need to dynamically calculate each year's data to today's data based on the exact date of each day, right?
    The data below is calculated using today's date as an example.

    YTD_by_Year = 
    CALCULATE(
        SUM('sales_data_2020_2024'[Sales]),
        DATESYTD('sales_data_2020_2024'[Date],"12/31"),
        'sales_data_2020_2024'[Date]<=DATE(YEAR('sales_data_2020_2024'[Date]),MONTH(TODAY()),DAY(TODAY())))
    YTD_by_2020 = CALCULATE(SUM(sales_data_2020_2024[Sales]),'sales_data_2020_2024'[Date]>=DATE(2020,1,1)&&'sales_data_2020_2024'[Date]<=DATE(2020,9,11))
     

    I hope my answer has helped you with your question, if you have any further questions you can always contact me and I will get back to you as soon as I see the message!

    Hope it helps!

     

    Best regards,
    Community Support Team_ Tom Shen

     

    If this post helps then please consider Accept it as the solution to help the other members find it more quickly.