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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
BIswajit_Das
Solution Supplier
Solution Supplier

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
Solution Supplier
Solution Supplier

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
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
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

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! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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