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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

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
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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