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,
That helps, thank you! If I want to select current year and last two years(2019-1-1 -> 2021-02-08) is that also possible with the relative data range slicer?
Mmm.... I don't think so. If you want something that custom you might need to play with a Calendar Table.
The relative will let you filter by last year (from today's date to 365 days before) or last year (calendar) (e.g. filtering completed years, if you put 1 last calendar year would be filtering by 2020)
Hope that make sense