Forum Discussion

ksheth's avatar
ksheth
Icon for Helper I rankHelper I
1 year ago
Solved

How to create a single slicer that can combine data from multiple columns?

Hello,   I have the below sample data: Person Bananas Apples Pears Grapes A Yes No Yes Yes B Yes No No Yes C No Yes No No D Yes Yes Yes Yes E No Yes Yes ...
  • v-venuppu's avatar
    1 year ago

    Hi ksheth ,

    Thank you for reaching out to Microsoft Fabric Community.

    Thank you FBergamaschi for the prompt response.

    I have developed a PBIX file using the given sample data.Please go through the attached PBIX file for your reference.

  • raja1992's avatar
    1 year ago

    I’ve had to do this before 🙂. The trick is to unpivot the fruit columns so they become rows:

    1. In Power Query, select the columns Bananas, Apples, Pears, Grapes.

    2. Right-click → Unpivot Columns.

    3. You’ll now have a table like:

    Person   Fruit    Value
    A        Bananas  Yes
    A        Apples   No
    A        Pears    Yes
    A        Grapes   Yes
    1. Load this back → use the new Fruit column in your slicer.

    2. Add a visual/filter where Value = "Yes" so only the “Yes” responses count.

    Now when you pick “Apples” in the slicer, Persons C, D, and E show up. Multi-select works too — if you pick Apples + Grapes, you’ll get everyone who said Yes to either of those fruits.

     

    👉 Tip: If you can’t change the model in Power Query, you could do something similar with UNION in DAX to reshape the data into a long table. But Power Query unpivot is the cleanest.