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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
BIswajit_Das
Continued Contributor
Continued Contributor

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
Continued Contributor
Continued Contributor

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

BIswajit_Das
Continued Contributor
Continued Contributor

Isn't there any workaround or any tricks

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

johnyip
Super User
Super User

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

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
Sept PBI Carousel

Power BI Monthly Update - September 2024

Check out the September 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

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

Top Solution Authors