Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Previous Year vs SAMEPERIODLASTYEAR

Hi Guys,

 

Could you suggest which would be the best practice to choose between(previous year vs sameperiodlastyear) to calculate the sale for Last year? bit Confused.

 

Regards,

RSD

  • Hi Anonymous,

     

    Previousyear: This function returns all dates from the previous year given the latest date in the input parameter. For example, if the latest date in the dates argument refers to the year 2009, then this function returns all dates for the year of 2008, up to the specified year_end_date.

     

    SAMEPERIODLASTYEAR: Returns a table that contains a column of dates shifted one year back in time from the dates in the specified dates column, in the current context.

     

    So as LivioLanzo said, to use which one is up to your circumstance.

     

    Regards,

    Frank

7 Replies

  • v-frfei-msft's avatar
    v-frfei-msft
    Icon for Community Support rankCommunity Support

    Hi Anonymous,

     

    Previousyear: This function returns all dates from the previous year given the latest date in the input parameter. For example, if the latest date in the dates argument refers to the year 2009, then this function returns all dates for the year of 2008, up to the specified year_end_date.

     

    SAMEPERIODLASTYEAR: Returns a table that contains a column of dates shifted one year back in time from the dates in the specified dates column, in the current context.

     

    So as LivioLanzo said, to use which one is up to your circumstance.

     

    Regards,

    Frank

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thanks Frank!!

  • it depends on your goal, normally 'sameperiodlastyear' is used but in some circumstances you may want to use 'previousyear'

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thanks Mate!!

       

      So If I want to create a measure to calculate the year-to-date sales and to compare those sales to the
      previous year for the same time period then SAMEPERIODLAST YEAR is the best choice right?