cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
BIswajit_Das
Helper V
Helper V

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
Helper V
Helper V

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
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

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

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors