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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Apply filter on date table for last year?

Hi, I've searched and searched but I can't get my queries straight.

 

I have a transaction table:

TransactionKeyDateKeyAccountAmount
111234133,50
23675678120,22

 

To this table we have a simple measure, "Sum of amount", which basically is SUM([Amount]).

 

The Date table looks like this:

DateKeyDateYearMonth
12019-01-01201901
22019-01-02201901
3672020-01-01202001

 

The relationship between them two are 1:*, so a transaction basically relates to a date.

 

My question is how I can create a measure that looks at the previous years period, when user filters are apploied on [Year] or [Month].

 

I tried SAMEPERIODLASTYEAR() on the date column, which worked, but the filters then won't work when selecting for example [Year] = 2020, and [Month] = 1.

 

What I want is a measure somehing like this (in pseudo): 

CALCULATE(
SUM([Amount]); ALL('Date'); FILTER(Date;Date[Year]-1)

)

It doesn't work - understandible - but it might give you a clue of what I am looking for?

 

I am using SSAS with compability level "SQL Server 2014 / SQL Server 2012 SP1 (1103)"

 

Best regards,

Linus

1 REPLY 1

Helpful resources

Announcements
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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.