Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
vmakhija
Post Prodigy
Post Prodigy

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

1 ACCEPTED SOLUTION
v-yuezhe-msft
Employee
Employee

@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

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
v-yuezhe-msft
Employee
Employee

@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

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
dujos
Helper I
Helper I

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

 

 

@dujos

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

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Regards

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

 

img3.png

 

 

 

 

 

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.