Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hi, I've searched and searched but I can't get my queries straight.
I have a transaction table:
| TransactionKey | DateKey | Account | Amount |
| 1 | 1 | 1234 | 133,50 |
| 2 | 367 | 5678 | 120,22 |
To this table we have a simple measure, "Sum of amount", which basically is SUM([Amount]).
The Date table looks like this:
| DateKey | Date | Year | Month |
| 1 | 2019-01-01 | 2019 | 01 |
| 2 | 2019-01-02 | 2019 | 01 |
| 367 | 2020-01-01 | 2020 | 01 |
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
https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490
Proud to be a Super User!
Awesome Keyboard Shortcusts in Power BI, thumbs up if you like the article
My Community Blog Articles (check them out!)
My Blog - Power M code to automatically detect column types -
How to create test data using DAX!
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 8 | |
| 6 | |
| 5 | |
| 5 | |
| 4 |
| User | Count |
|---|---|
| 25 | |
| 16 | |
| 8 | |
| 7 | |
| 7 |