Forum Discussion

Willborn's avatar
Willborn
Advocate III
9 years ago
Solved

Going back 2 years instead only 1

Hi there

 

I'm using the SAMEPERIODLASTYEAR-Function. Is there a way to get the year bevor the previous year (2016 YTD + 2015 same period + 2014 same periode)?

 

Currently in use:

SaleP2YTot = CALCULATE([SaleTot]; SAMEPERIODLASTYEAR('Dates'[Date]))

Thanks for any input & Regards!

 

3 Replies

    • Willborn's avatar
      Willborn
      Advocate III

      Thank you smoupre!

       

      SalesP2YTot = CALCULATE([SalesTot]; DATEADD(Dates[Date]; -2; year))

       

      Did not realized that I have to replace the "sameperiodlastyear"-Function. But it's working well.

       

      What about when calculation the cummulative sales total? Can I use the same functionality like as:

       

      CumSalesP2YTot = CALCULATE (
          [SalesPYTot];
          FILTER (
              ALLSELECTED(Dates);
              'Dates'[Date] <= DATEADD(Dates[Date]; -1; year)
                  && 'Dates'[Date] <= TODAY()
          )
      )

       

       

      Regards Patrick