Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

SAMEPERIODLASTYEAR - Not showing data for last year, instead shows same data

 Hello

I have created measure as follows -

PrevSales =
CALCULATE(SUM(FactInternetSales[SalesAmount]), SAMEPERIODLASTYEAR(DimDate[FullDateAlternateKey].[Date]))

 

However, it is not showing data for last year. Instead it shows same data. Below is the screenshot -

 

 

 

 

 

 

 

 

 

 

 

Any idea on this?

 

Regards

  • Anonymous's avatar
    Anonymous
    7 years ago

    Anonymous,

    Please drag year/date field of your DimDate table to table visual along with the PrevSales measure. You will get incorrect result if you drag year/date field of FactInternetSales table into table visual.

    Regards,
    Lydia

4 Replies

  • Hello vmakhija,

     

    First try to remove .[Date] in the end of your formula.

     

    Below an example of the formula of mine:

     

     

    PrevSales = CALCULATE([Total Sales]; SAMEPERIODLASTYEAR('Calendar'[Date]))

     

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      dujos

      Tried that. It gives all blanks for some reason -

       

       

       

       

       

       

       

       

       

       

       

       

       

       

      Regards

      • dujos's avatar
        dujos
        Icon for Helper I rankHelper I

        vmakhija, your data type on FactInternetSales[OrderDate] is the same of DimDate[FullDateAlternateKey]?

         

         

         

         

         

         

  • Anonymous's avatar
    Anonymous
    Not applicable

    Anonymous,

    Please drag year/date field of your DimDate table to table visual along with the PrevSales measure. You will get incorrect result if you drag year/date field of FactInternetSales table into table visual.

    Regards,
    Lydia