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 there 🙂
I know it is possible in query editor to do a 'last n calendar years' AND 'this year' but I want to achieve this in a visual.
So I can apply the last n calendar years, but it excludes the current incomplete year - and there is no option for an AND in the visual level filters pane.
Is there a way to achieve this?
Solved! Go to Solution.
The inbuilt relative date filtering is pretty bad. The only way I've found to do this sort of thing in the past is to add a column to the date table which returns true or false depending on the logic you need, e.g.
Is in last 4 years =
var startYear = YEAR( TODAY()) -5
var endYear = YEAR(TODAY()) - 1
return 'Date'[Year] >= startYear && 'Date'[Year] <= endYear
The inbuilt relative date filtering is pretty bad. The only way I've found to do this sort of thing in the past is to add a column to the date table which returns true or false depending on the logic you need, e.g.
Is in last 4 years =
var startYear = YEAR( TODAY()) -5
var endYear = YEAR(TODAY()) - 1
return 'Date'[Year] >= startYear && 'Date'[Year] <= endYear
Because my Year is a text column I had to adapt the calculated column to:
Previous 4 Years =
VAR Year = VALUE ('Dates'[Year])
VAR startYear = YEAR ( TODAY ()) -3
VAR endYear = YEAR( TODAY ())
RETURN
Year>= startYear || Year = endYear
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 |
---|---|
99 | |
98 | |
80 | |
75 | |
66 |
User | Count |
---|---|
136 | |
109 | |
104 | |
82 | |
73 |