Forum Discussion

BIswajit_Das's avatar
BIswajit_Das
Icon for Impactful Individual rankImpactful Individual
3 years ago
Solved

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

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

  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi  BIswajit_Das ,

     

    Here are the steps you can follow:

    1. In Power Query , copy the Table.

    Table(2):

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

    Right-click the mouse -- Remove Duplicates:


    Table(3):

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

    Right-click the mouse -- Remove Duplicates:

    Table(3):

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

    Right-click the mouse -- Remove Duplicates:

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

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

    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.

    5. Result:

     

     

    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

7 Replies

  • mlsx4's avatar
    mlsx4
    Icon for Memorable Member rankMemorable Member

    Hi BIswajit_Das 

     

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

     

     

  • johnyip's avatar
    johnyip
    Icon for Solution Sage rankSolution Sage

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

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi  BIswajit_Das ,

     

    Here are the steps you can follow:

    1. In Power Query , copy the Table.

    Table(2):

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

    Right-click the mouse -- Remove Duplicates:


    Table(3):

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

    Right-click the mouse -- Remove Duplicates:

    Table(3):

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

    Right-click the mouse -- Remove Duplicates:

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

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

    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.

    5. Result:

     

     

    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's avatar
    BIswajit_Das
    Icon for Impactful Individual rankImpactful Individual

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

    • mlsx4's avatar
      mlsx4
      Icon for Memorable Member rankMemorable Member

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