Forum Discussion

wasequesiddiqui's avatar
wasequesiddiqui
Regular Visitor
9 years ago
Solved

Improper Functioning of PreviousYear Function

  I am trying to get the sales of Previous Year but somehow previousyear function is not giving me the desired result. [LY Sales Col] is my previous year sales column.
  • v-haibl-msft's avatar
    9 years ago

    wasequesiddiqui

     

    You need to create a calendar table and create relationship between these two tables with Date key. Then use PREVIOUSYEAR Function (DAX) like below.

     

     

    LY Sales =
    CALCULATE ( SUM ( SALESSHEET[Sales] ), PREVIOUSYEAR ( 'Calendar'[Date] ) )

     

    Best Regards,

    Herbert