Forum Discussion

ConstMoss's avatar
ConstMoss
Icon for Helper I rankHelper I
9 years ago
Solved

same week last year

our week starts mon and ends sunday. when looking at sales and comparing with last year, how do we get the right dates?  for example, if i want to compare this week (10/23/2017 to 10/29/2017) with l...
  • Vvelarde's avatar
    Vvelarde
    9 years ago

    ConstMoss

     

    Hi, try with a measure like this:

     

    VentasLY-SameWeek =
    CALCULATE (
        SUM ( Ventas[Ventas] ),
        FILTER (
            ALL ( Calendario ),
            Calendario[Año]
                = SELECTEDVALUE ( Calendario[Año] ) - 1
                && Calendario[Semana] = SELECTEDVALUE ( Calendario[Semana] )
        )
    )

    I use a calendar table with year and week columns. (Calendario)

     

    Regards

     

    Victor

    Lima - Peru