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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
BIswajit_Das
Super User
Super User

Power BI Slicer

Hello team need to figure out a way to use values from 2 columns used as slicer options in a slicer
Here used table is

idgenderage
am23
bm23
cf22
dt20
ef20

I want to make a slicer with the values based on both gender and age column
E.g

s1.PNG

When i clicked on the slicer value it should filter the above table
Thanks

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

Hi  @BIswajit_Das ,

 

Here are the steps you can follow:

1. In Power Query , copy the Table.

vyangliumsft_0-1689907110699.png

Table(2):

Select [age] and [id] – Home – Remove Columns.

vyangliumsft_1-1689907110703.png

Right-click the mouse -- Remove Duplicates:

vyangliumsft_2-1689907125142.png
vyangliumsft_3-1689907125143.png

Table(3):

Select [gender] and [id] – Home – Remove Columns.

vyangliumsft_4-1689907140499.png

Right-click the mouse -- Remove Duplicates:

vyangliumsft_5-1689907140499.png

Table(3):

Select [gender] and [id] – Home – Remove Columns.

vyangliumsft_6-1689907155277.png

Right-click the mouse -- Remove Duplicates:

vyangliumsft_7-1689907155277.png

2. Home – Append Queries -- Append Queries as new .

vyangliumsft_8-1689907214477.png

Select both [gender] and [age] -- Right-click the mouse – Merge Columns.

vyangliumsft_9-1689907214477.png

3. Create measure.

Measure =
var _select=SELECTEDVALUE('Append1'[Merged])
return
IF(
    _select in SELECTCOLUMNS('Table',"age",CONVERT('Table'[age],STRING)) || _select in SELECTCOLUMNS('Table',"gender",'Table'[gender]),1,0)

4. Place [Flag]in Filters, set is=1, apply filter.

vyangliumsft_10-1689907319733.png

5. Result:

vyangliumsft_11-1689907319735.png

 

 

Best Regards,

Liu Yang

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

7 REPLIES 7
v-yangliu-msft
Community Support
Community Support

Hi  @BIswajit_Das ,

 

Here are the steps you can follow:

1. In Power Query , copy the Table.

vyangliumsft_0-1689907110699.png

Table(2):

Select [age] and [id] – Home – Remove Columns.

vyangliumsft_1-1689907110703.png

Right-click the mouse -- Remove Duplicates:

vyangliumsft_2-1689907125142.png
vyangliumsft_3-1689907125143.png

Table(3):

Select [gender] and [id] – Home – Remove Columns.

vyangliumsft_4-1689907140499.png

Right-click the mouse -- Remove Duplicates:

vyangliumsft_5-1689907140499.png

Table(3):

Select [gender] and [id] – Home – Remove Columns.

vyangliumsft_6-1689907155277.png

Right-click the mouse -- Remove Duplicates:

vyangliumsft_7-1689907155277.png

2. Home – Append Queries -- Append Queries as new .

vyangliumsft_8-1689907214477.png

Select both [gender] and [age] -- Right-click the mouse – Merge Columns.

vyangliumsft_9-1689907214477.png

3. Create measure.

Measure =
var _select=SELECTEDVALUE('Append1'[Merged])
return
IF(
    _select in SELECTCOLUMNS('Table',"age",CONVERT('Table'[age],STRING)) || _select in SELECTCOLUMNS('Table',"gender",'Table'[gender]),1,0)

4. Place [Flag]in Filters, set is=1, apply filter.

vyangliumsft_10-1689907319733.png

5. Result:

vyangliumsft_11-1689907319735.png

 

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

BIswajit_Das
Super User
Super User

Thanks for responding
But I need to use both columns values as options in the slicer as i mentioned on the post

Yes, I know. But Power BI just nests two columns... It doesn't allow multiple columns in a slicer

Isn't there any workaround or any tricks

I don't think so, but... Let's wait and see if anyone knows something

johnyip
Solution Sage
Solution Sage

you could use a nested slicer, or simply utilize two slicers: one for gender another for age.



Please mark my post as the solution if this answers your question!
Appreciate your Kudos !!
mlsx4
Memorable Member
Memorable Member

Hi @BIswajit_Das 

 

I think that the maximum you can achieve is a nested slicer (if you only want one slicer):

 

mlsx4_0-1689751005948.png

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Feb2025 NL Carousel

Fabric Community Update - February 2025

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