Forum Discussion
cmckinney
5 years agoHelper IV
FILTER function using current slicer selection
Is it possible to pass the current selection of a slicer into a FILTER function in a measure? For example: FILTER(<table>, Column1 = Current Slicer Selection)
- 5 years ago
You can use ALLSELECTED([ColumnName]) It is designed to work with slicers. It is intended to work in a CALCULATE() function, so you really don't need the FILTER() function.
edhans
5 years agoCommunity Champion
You can use ALLSELECTED([ColumnName]) It is designed to work with slicers. It is intended to work in a CALCULATE() function, so you really don't need the FILTER() function.
- edhans5 years agoCommunity Champion
Yes, it returns a table, so anywhere you need a table, like MAXX() does, it should work
- TomMartens5 years agoSuper User
Hey cmckinney
as edhans
- SELECTEDVALUE(...) is good to capture a single value and just a single value
- VALUES(...) allows capturing multiple selected values from a slicer
- you have to use VALUES inside the FILTER function like so
FILTER( t , t[c] IN VALUES())
As VALUES(...) returns a table it can also be used as the table parameter in one of the table iterator functions like MAXX -
Personally, I would not use ALLSELECTED as this is one of the most complex functions, and I like my DAX statements simple 🙂
Regards,
Tom
- you have to use VALUES inside the FILTER function like so