Forum Discussion
Dynamic year filter
- 5 years ago
Hi, jhaast
Yes, you can. You don't need to use slicer. You can use a measure in the filterpane of the visuals you want to pin to the dashboard, then it will change dynamically.
Like this:
Measure = VAR a = YEAR ( TODAY () ) RETURN IF ( VALUES ( 'Table'[Year] ) IN { a, a - 1, a - 2 }, 1, 0 ) //if you use date ,you can try:IF ( Year ( 'Table'[Date] ) IN { a, a - 1, a - 2 }, 1, 0 )If it doesn’t solve your problem, please feel free to ask me.
Best Regards
Janey Guo
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, jhaast
The slicer cannot be pinned to the dashboard, so what is the data you put on the dashboard, measure or column? Can you explain it in detail?
Best Regards
Janey Guo
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Items which I would pin to the dashboard are:
- A table like this one:
- Or a bar chart like this one:
So currently, 2019, 2020 en 2021 are manually select but when the year changes to 2022 I would see 2020, 2021 and 2022 and I need to change the years manually. It would be great if I could select last two years and current year with a relative date filter.
An solution should be the option to select current year in the filter / slicers below:
Like the posibility to select "Today" for the filtering in days.
Could this be possible?
- v-janeyg-msft5 years agoCommunity Support
Hi, jhaast
Yes, you can. You don't need to use slicer. You can use a measure in the filterpane of the visuals you want to pin to the dashboard, then it will change dynamically.
Like this:
Measure = VAR a = YEAR ( TODAY () ) RETURN IF ( VALUES ( 'Table'[Year] ) IN { a, a - 1, a - 2 }, 1, 0 ) //if you use date ,you can try:IF ( Year ( 'Table'[Date] ) IN { a, a - 1, a - 2 }, 1, 0 )If it doesn’t solve your problem, please feel free to ask me.
Best Regards
Janey Guo
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.