Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Help: Using PREVIOUSYEAR() returns a Blank column...

I am using the following to calculate a goal measure:

 

goal = calculate(count(FactInternetSales[CustomerKey]),PREVIOUSYEAR(FactInternetSales[OrderDate]))*1.05

 

 

But get a blank column. How to deal with it?

 

The data structure is like the following:

 

 

  • Hi Anonymous ,

    To use previous year function, you can create a continuous date table by this measure:

     

    Table = CALENDARAUTO()

     

    Then modify your measure like this:

     

    goal = calculate(count(FactInternetSales[CustomerKey]),PREVIOUSYEAR('Table'[Date]))*1.05

     

    You will get the following result:

     

    Here is the demo , please try it:

    PBIX 

     

    Best Regards,

    Yingjie Li

     

    If this post helps then please consider Accept it as the solution to help the other members find it more quickly.

3 Replies

  • v-yingjl's avatar
    v-yingjl
    Community Support

    Hi Anonymous ,

    To use previous year function, you can create a continuous date table by this measure:

     

    Table = CALENDARAUTO()

     

    Then modify your measure like this:

     

    goal = calculate(count(FactInternetSales[CustomerKey]),PREVIOUSYEAR('Table'[Date]))*1.05

     

    You will get the following result:

     

    Here is the demo , please try it:

    PBIX 

     

    Best Regards,

    Yingjie Li

     

    If this post helps then please consider Accept it as the solution to help the other members find it more quickly.

    • Anonymous's avatar
      Anonymous
      Not applicable

      I know how to use SAMEPERIODLASTYEAR instead; but I want to know how to use PREVIOUSYEAR?