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!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hello,
I would like to use a slicer on my year field to display the desired year and the 5 previous years.
According to the different solutions that I could find online, I created a 2nd table with years to filter my other table with the following measure (année means year in french) :
However the measure does not achieve what I want, I get the result below for the year 2021 selected (in Year Table):
| Année d'octroi (projet) | Mfilter |
| 2015 | 0 |
| 2016 | 0 |
| 2017 | 0 |
| 2018 | 0 |
| 2019 | 0 |
| 2020 | 0 |
| 2021 | 0 |
Could you help me? (I specify that I am under Power BI 2020)
Thanks in advance !
Solved! Go to Solution.
Hi @LeroyPaul ,
Check below measure:
Measure =
var start_ = SELECTEDVALUE('Year Table'[Année])-5
var end_ = SELECTEDVALUE('Year Table'[Année])
var date1 = SELECTEDVALUE('5 - Requêtes BO Consolidé'[Année d'octroi (projet)])
return
IF(date1>=start_&&date1<=end_,1,0)
Make sure there's no relationship between year table and fact table.
Best Regards,
Jay
Hi @LeroyPaul ,
Check below measure:
Measure =
var start_ = SELECTEDVALUE('Year Table'[Année])-5
var end_ = SELECTEDVALUE('Year Table'[Année])
var date1 = SELECTEDVALUE('5 - Requêtes BO Consolidé'[Année d'octroi (projet)])
return
IF(date1>=start_&&date1<=end_,1,0)
Make sure there's no relationship between year table and fact table.
Best Regards,
Jay
Thank you very much, that's exactly it!
There must be a more simple solution, I can't adapt the solution of the video to my problem
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 39 | |
| 38 | |
| 38 | |
| 28 | |
| 27 |
| User | Count |
|---|---|
| 124 | |
| 88 | |
| 73 | |
| 66 | |
| 65 |