Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi All,
I have date table with 3 yrs of data.When I want to bring the date to slicer I should see only 2 yrs of data. For eg slicer should show 2022 and 2021. Next year it should be 2023 and 2022. It should not be hard-coded in filters.
Automatically only 2 yrs value should be shown in slicer
Can we bring this in measure?
Any help is much appreciated
Solved! Go to Solution.
Hi,
Thank you for your feedback.
I am not sure if I understood your question correctly, but please check the below picture and the attached pbix file.
One of ways is to apply calculated column to report level filter pane.
Hi,
one of ways to achieve this is to create a measure something like below, and put it into Visual Filter pane and set it up like below.
Please also check the attached pbix file.
Last two years measure: =
VAR _currentyear =
YEAR ( TODAY () )
VAR _previousyear = _currentyear - 1
RETURN
IF (
SELECTEDVALUE ( 'Year'[Year] ) = _currentyear
|| SELECTEDVALUE ( 'Year'[Year] ) = _previousyear,
1,
0
)
Thank you so much.But when I try to apply this measure for all pages I could not bring the measure to filter on all pages. Is there any other way to do it?
Hi,
Thank you for your feedback.
I am not sure if I understood your question correctly, but please check the below picture and the attached pbix file.
One of ways is to apply calculated column to report level filter pane.
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
26 | |
10 | |
10 | |
9 | |
6 |