Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi,
I was wondering if I can apply a dynamic filter in Desktop.
A table (directly to SQL Server OLTP DB) has column [Year] (= transactional year) and I added custom column [CurrYear] to that recordset in the Power BI Query Editor which holds the current year.
Another table in Power BI holds the time "dimension" (from year 1990 until year 2030).
I have a slicer that pulls the years from this dimension, but I would like to filter the years in this slicer to only the years between the current year and the last 3 years. So [Year] between [CurrYear] and [CurrYear] - 3.
As far as I can see I can only enter static values in the filter editor (i.e. [Year] between 2013 and 2016).
Is there a way to use dynamic values?
Thanks!
regards,
Michiel
Hi @bijntjede2e
You could enrich your date table by adding a calculated column for relative year
Relative Year = INT(YEAR([Date]) - YEAR(TODAY()))
and use it as filter onto your report, page or visual.and select the values according to the scope you want to analyze, in your example 0,-1,-2.
The best eway to accomplish that is in query editor since you will end up with a smaller data model.. @greggyb has a great solution in query editor that is exact what you need ( I thing for rlolling months but you can adjust it for years ) but I cannot dig up his post..
If he cannot reply I wrote a post how to create dynamic filtering in Query editor but is based on dates in other tables..i.e if you need the date dimention to contain dates that are only is transactional table..
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
112 | |
97 | |
84 | |
67 | |
59 |
User | Count |
---|---|
150 | |
120 | |
99 | |
87 | |
68 |