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
yaman123
Post Partisan
Post Partisan

SAMEPERIODLASTYEAR error

Hi, 

 

I have a simple dax formula to calculate the sum for the same period last year - 

 

Measure =
CALCULATE(
    SUM(
        Query1[RECEIVED_TOTAL_LINE]),
        SAMEPERIODLASTYEAR(Query1[REAL_DELIVERY_DATE]))
 
I only have one table (Query1) as it is a simple report and do not have a date table. I have a sbetween slicer on real delivery date. I am getting an error 'expects a contiguous selection when the date column is not unique, has gaps or it contains time portion' 
 
Is there any way around this? 
 
Thanks
1 REPLY 1
johnt75
Super User
Super User

The time intelligence functions need a proper date table to work correctly. Set one up, mark it as a date table and then use that in your slicer, your visuals and your measures.

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.