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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
AlienBI
Frequent Visitor

Issue with SAMETIMELASTYEAR

Hi there, 

I'm having troubles with SAMETIMELASTYEAR. I want to show what the revenue was LY at the same time in the table below from April 2025 to September 2025. I have a date filter for this, but it doesn't apply to my LY calculation - it shows data beyond September 25.
How do I make it work?

See here PBIX link and below for details:

AlienBI_2-1757984132101.png

 

My LY measure is :

LY_T&K = CALCULATE(sum('RA Subset'[T&K]),ALLEXCEPT('Calendar','Calendar'[Date].[Date]),SAMEPERIODLASTYEAR('Calendar'[Date].[Date]))

My calendar table is:
Calendar = CALENDAR(Date(2024,07,01),Date(2025,09,30))
Thanks for your help!

 







1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi,

Please try something like below.

Please check the below image and the attached pbix file.

I tried to create [LY_T&K fix] measure.

 

Jihwan_Kim_0-1757992054206.png

 

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

2 REPLIES 2
Jihwan_Kim
Super User
Super User

Hi,

Please try something like below.

Please check the below image and the attached pbix file.

I tried to create [LY_T&K fix] measure.

 

Jihwan_Kim_0-1757992054206.png

 

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.
danextian
Super User
Super User

Hi @AlienBI 

First, as a best practice, dispable auto-datetime and explicity create date element columns (year, month, quarter, etc). Auto-datetime creates an invisible table of dates for almost all date columns in your model and thus take up space.

 

Modify your formula to below:

CALCULATE (
    SUM ( 'RA Subset'[T&K] ),
    SAMEPERIODLASTYEAR ( 'Calendar'[Date] )
)

Ensure that the date/calendar table has been marked as such - Set and use date tables in Power BI Desktop . If not you will have to explicityly include a REMOVEFILTERS to your measure.

CALCULATE (
    SUM ( 'RA Subset'[T&K] ),
    SAMEPERIODLASTYEAR ( 'Calendar'[Date] ),
    REMOVEFILTERS ( 'Calendar' )
)

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.