Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Anonymous
Not applicable

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?

sophhhlee_0-1626854397895.png

 

1 ACCEPTED SOLUTION
v-stephen-msft
Community Support
Community Support

Hi @Anonymous ,

 

Since your data is simple, just create the following seperate table

7.png

 

Then create a measure

Lag = SWITCH(SELECTEDVALUE('Table (2)'[Category]),"Lag1","Lag1","Lag2","Lag2")

8.png9.png

 

 

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.

View solution in original post

5 REPLIES 5
v-stephen-msft
Community Support
Community Support

Hi @Anonymous ,

 

Since your data is simple, just create the following seperate table

7.png

 

Then create a measure

Lag = SWITCH(SELECTEDVALUE('Table (2)'[Category]),"Lag1","Lag1","Lag2","Lag2")

8.png9.png

 

 

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.

Anonymous
Not applicable

hello @v-stephen-msft 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.

amitchandak
Super User
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

)

 

 

Anonymous
Not applicable

@amitchandak hmm where would I insert the measure? as a visual level filter?

@Anonymous , slicer or filter should come from leg table. 

 

measure you should in filter as value 

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.