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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
RobvB
Frequent Visitor

SamePeriodLastYear - does not work when adding date to the table?

There are a ton of posts here about SamePeriodLastyear, but I have not been able to find one that describes my problem:

 

* Using AutoQuery to SQL

* Created Dates table using CalendarAuto(12)

* Created relation from my transaction table date field to the Dates table

* Measure: TotalSales = SUM(ITK_Retail_AM_ITKRetailTransactionsView[AALINEAMOUNT])

* Measure: TotalSalesLastYear = CALCULATE(ITK_Retail_AM_ITKRetailTransactionsView[TotalSales], SAMEPERIODLASTYEAR(ITK_Dates[Date]))

* If I create a table to show just TotalSales and TotalSalesLastYear, it works. I can filter on (for instance) category, and it shows the proper numbers for that category:

working.jpg

 

However, when I add the date column to the table, the numbers are not correct for the line, but they are for the totals. On the line level it shows the same amount for both columns.

(Note that the date slicer on top is set to make sure all dates in the table are selected)

NotWorking.jpg

What am I missing here ?

 

 

2 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

@RobvB , you need to add a date column from the date table ITK_Dates. you need to use ITK_Dates[Date]

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

mahoneypat
Microsoft Employee
Microsoft Employee

Use the Date column from your date table intead of the TransDate column from fact table.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

2 REPLIES 2
mahoneypat
Microsoft Employee
Microsoft Employee

Use the Date column from your date table intead of the TransDate column from fact table.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


amitchandak
Super User
Super User

@RobvB , you need to add a date column from the date table ITK_Dates. you need to use ITK_Dates[Date]

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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