Forum Discussion
yuvanne_11
4 years agoFrequent Visitor
Filter Option
Hi, I want to create a measure and use that as a filter. So I am dealing with the inventory dashboard. I have columns such as >4 years, <4 years, < 3 years, < 2 years, and so on. These are in curren...
- 4 years ago
You cannot use a measure as a filter. What you could do is create a calculated column that evaluates the closing stock date and assigns it the closing stock value. That calculated column could then be used as a filter.
yuvanne_11
4 years agoFrequent Visitor
But that calculated column would give the options in numbers, right? Instead I just want the text to be displayed
jgeddes
4 years agoSuper User
It would not have to be numbers, it could be text. Here is an example measure;
Date Group =
var _dateDiff =
DATEDIFF(TODAY(),dimDate[Date],YEAR)
Return
SWITCH(
TRUE(),
_dateDiff = 0, "Year 2022",
AND(_dateDiff < 0, _dateDiff >= -1), "Year 2021",
AND(_dateDiff < -1, _dateDiff >= -2), "Year 2020",
AND(_dateDiff > 0, _dateDiff <= 1), "Year 2023",
"Other Year"
)
This measure would produce a column that would show up in a filter like