Forum Discussion

Rygar's avatar
Rygar
Icon for Helper II rankHelper II
4 years ago
Solved

Substitute TotalYTD with Calculate? (best Practice)

Hi Community,

 

I have this two expressions:

CALCULATE(
    [Sum Quantity],
        DATEADD(dDate[Date],
        -1,
        MONTH
    )
 
TOTALYTD(
        [Sum Quantity],
        dDate[Date],
        DATEADD(dDate[Date],-1,MONTH)
    )
 
Both bring the same result, as expected. Which one is the better solution?
Thanks & regards
Michael
  • Hey,

     

    If you would like to know the quantity of the previous month I would go for the CALCULATE version. That variant is more logical and natural. Moreover, the YTD variant does not work for January, because YTD is always based on the current year (the previous month, December of the previous year, is not in scope).

2 Replies

  • Barthel's avatar
    Barthel
    Icon for Solution Sage rankSolution Sage

    Hey,

     

    If you would like to know the quantity of the previous month I would go for the CALCULATE version. That variant is more logical and natural. Moreover, the YTD variant does not work for January, because YTD is always based on the current year (the previous month, December of the previous year, is not in scope).

    • Rygar's avatar
      Rygar
      Icon for Helper II rankHelper II

      Hey Barthel, thank you very much for your advice!