Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.
I'm trying to create a date filter which will filter past 3 years data based on selection in a PBI matrix. The columns are the years. Below is a screenshot of how the marix looks like:
So if I select 2024 in date filter, it should display 2024, 2023 and 2022. if I select 2023, it should display 2023,2022, 2021. I realise there are previous posts similar to this, but they dont seem to work for matrix since I need to put Year in columns instead of values (previous results suggest creating a measure, which cannot go into pbi matrix column. only in values)
I have a separate date table which is related to all the other tables
Have a look at https://www.sqlbi.com/articles/show-previous-6-months-of-data-from-single-slicer-selection/ . By putting 'Previous Dates'[Year] in the matrix you should get the behaviour you are looking for.
Create a new measure
Filtered Endorsements =
VAR SelectedYear = SELECTEDVALUE(DateTable[Year])
RETURN
CALCULATE(
SUM('YourDataTable'[Endorsements]),
FILTER(
ALL(DateTable),
DateTable[Year] >= SelectedYear - 2 && DateTable[Year] <= SelectedYear
)
)
๐ If this helped, a Kudos ๐ or Solution mark โ๏ธwould be great! ๐
Cheers,
Kedar
Connect on LinkedIn
hi @adityah ,
To achieve this, follow below process
1. create a separate calender dimention table covering all the dates in your dataset. dont create any relationship.
2. use this date in your slicer
3. now you need to create three different measures for "new", "endrosment","GWP" as per below syntax.
measure =
var start_year_Base =year( selectedvalue(dim_calender[date])]) - 2
var end_year_Base =year( selectedvalue(dim_calender[date])])
return
calculate (sum(table,[GWP]),year(table[date])>=start_year_base,year(table[date])<=end_year_base)
This should work. please share sample data if it fails.
Hi @adityah , hello All, thank you for your prompt reply!
Create a new calculated Date table as the slicer, then create a new measure as shown below:
past 3 years =
VAR data_year = YEAR(SELECTEDVALUE('FactTable'[date]))
VAR slicer_year = SELECTEDVALUE('DuplicateDate'[Date].[Year])
RETURN
IF(data_year<=slicer_year && data_year>slicer_year-3,
1,
0
)
Then add the measure to visual filter like this:
Result for your reference:
Best regards,
Joyce
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Check out the November 2025 Fabric update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!