Forum Discussion

jasemilly's avatar
jasemilly
Icon for Helper III rankHelper III
5 years ago
Solved

using variables in function TotalYTD

Hi I am trying to create a measure to show % increase/decrease between the current rolling year, sum of values one whole year ending today, against the previous. I have been trying to use TOTALYTD...
  • v-jingzhang's avatar
    5 years ago

    jasemilly  How about using YEAR instead of DAY in DATESINPERIOD function? Just like below. This will work well without the leap year issue.

    CALCULATE (
    [Vehicles],
    DATESINPERIOD ( 'dates'[Date], TODAY(), -1, YEAR )
    )

     

    Reference: https://docs.microsoft.com/en-us/dax/datesinperiod-function-dax

     

    Best Regards,

    Community Support Team _ Jing Zhang

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