Forum Discussion
How do I create a slicer to filter 2 column headers?
Hi all, I am really stuck trying to create 1 slicer that can filter the 'Lag1' and 'Lag2' columns for a matrix visual.
Basically, the slicer should have only 2 options - 1) Lag1 and 2) Lag2. When the user clicks on "Lag1" for example, only rows that are labelled "Lag1" should be filtered. I cannot concat the 2 columns as there are overlaps, some Lag1s are also Lag2s. Can I ask if this is possible? Or how else should I go about making this slicer?
- Anonymous5 years ago
Hi Anonymous ,
Since your data is simple, just create the following seperate table
Then create a measure
Lag = SWITCH(SELECTEDVALUE('Table (2)'[Category]),"Lag1","Lag1","Lag2","Lag2")Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
5 Replies
- amitchandak
Super User
Anonymous , You need to create independent table
leg =
Distinct(union(
summarize(Table, [Leg1], "Name", "Leg1"),
summarize(Table, [Leg2], "Name", "Leg2")
))
You can use this as an independent filter
example measure
Switch( selectedvalues(leg[Name]) , //Name is leg1
"Leg1" , calculate(countrows(Table), filter(Table[leg1] in values(Leg[Leg1]))),
"Leg2" , calculate(countrows(Table), filter(Table[leg2] in values(Leg[Leg1]))) //name leg 1 in new table
)
- AnonymousNot applicable
amitchandak hmm where would I insert the measure? as a visual level filter?
- amitchandak
Super User
Anonymous , slicer or filter should come from leg table.
measure you should in filter as value
- AnonymousNot applicable
Hi Anonymous ,
Since your data is simple, just create the following seperate table
Then create a measure
Lag = SWITCH(SELECTEDVALUE('Table (2)'[Category]),"Lag1","Lag1","Lag2","Lag2")Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- AnonymousNot applicable
hello Anonymous although this post has been a while, but I think it is very useful and would like to know this same method could also apply to the headers where contains the same string. like lag1-a, lag1-b, lag1-c; lag2-a,lag2-b, lag2-c? Thanks in advance.