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.

3 Replies

  • v-haibl-msft's avatar
    v-haibl-msft
    Microsoft Employee

    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

    • wasequesiddiqui's avatar
      wasequesiddiqui
      Regular Visitor

      Thanks for the prompt response. Your solution worked like a charm!

  •  

    I have tried changing the column for previousyear function still it is not working