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
hnk1
Regular Visitor

SAMEPERIODLASTYEAR not working with filters

I created a measure to have de Sum of Last Year:

Vorjahr = CALCULATE(SUM(Tabelle1[Anzahl]),SAMEPERIODLASTYEAR(Tabelle1[Date]))

hnk1_0-1625722581858.png

 

When i have the following table, everything is working:

 

hnk1_2-1625722616605.png

 

But if I add a dimension to the table, which i filter, then the numbers in the column Vorjahr aren't corret:

hnk1_3-1625722683128.png

 

Without the dimension in the table, just filtering it, the numbers are correct:

hnk1_4-1625722728594.png

 

Can somebody help me with this? How can i add dimensions in the table and filter them so that the numbers are still correct?

 

Thank you

Greeting Karen

 

 

 

 

 

3 REPLIES 3
amitchandak
Super User
Super User

@hnk1 , Make sure you use date table for that. Also you date in table should not have timestamp

 

Vorjahr = CALCULATE(SUM(Tabelle1[Anzahl]),SAMEPERIODLASTYEAR(Date[Date]))

 

or

 

Vorjahr = CALCULATE(SUM(Tabelle1[Anzahl]),dateadd(Date[Date],-1,year))

 

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.

 

Why Time Intelligence Fails - Power bi 5 Savior Steps for TI: https://youtu.be/OBf0rjpp5Hw

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hi

 

Thank you for your useful tip. Now i created a datetable, and it's more or less working, the only thing is, that when i now filter via Jahr (from the "basistable") then which is dependent on the scenario (Ist = 2010 - 2020, Reference scenario = 2020-2029) I still get the 2021 in the table in which I have the year from the date_tbl. can this still be excluded somehow? If I take the year Basistbelle (tabelle 1), the Measures are no longer correct

hnk1_0-1625735648942.png

hnk1_1-1625735697090.png

hnk1_2-1625735734552.png

 

Thank you, best Regards

 

 

@hnk1 , If you are using date table and time intelligence. Then take all time-related tables from the date table, not from the fact table.

The year should come from date table if I got it correctly.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.