Reply
Member
Posts: 124
Registered: ‎01-21-2018
Accepted Solution

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 -SAMEPERIODLASTYEAR.JPG

 

 

 

 

 

 

 

 

 

 

 

Any idea on this?

 

Regards


Accepted Solutions
Highlighted
Moderator
Posts: 9,512
Registered: ‎03-10-2016

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

@vmakhija,

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

View solution in original post


All Replies
Frequent Visitor
Posts: 9
Registered: ‎10-06-2018

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

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]))

 

 

Member
Posts: 124
Registered: ‎01-21-2018

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

@dujos

Tried that. It gives all blanks for some reason -SAMEPERIODLASTYEAR1.JPG

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Regards

Frequent Visitor
Posts: 9
Registered: ‎10-06-2018

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

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

 

img3.png

 

 

 

 

 

Highlighted
Moderator
Posts: 9,512
Registered: ‎03-10-2016

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

@vmakhija,

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