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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
lauren2021
Frequent Visitor

Slicer to Select Column without Unpivoting Table

Hello, 

 

I am looking for a way to create a slicer that will allow a user to select which column to filter by, without unpivoting the table. For example, I have a table called 'Inventory' that looks somewhat like this: 

lauren2021_0-1611095752392.png

I then have a donut chart that displays % and counts for my inventory (i.e. Inventory by Color shows 2 Red(10%ish), 4 Yellow, 5 Blue). However, I would like the user to be able to select which 'slice' of inventory they're looking at. So the slicer would have Color, Shape, and Price as single-select options. When they select Color, they see inventory counts broken out by Color, Shape by Shape, etc. Is this possible without unpivoting the table?

 

For context, I have other charts that show how much inventory is bought based on Color, Shape, Price and want to be able to compare with current inventory, but don't want to clog up the page by adding 3 more charts. So for example if we saw that Blue had the most purchases by Color, we can see that Blue makes up the most of the inventory so that adds up.

 

Thanks for any help!

1 ACCEPTED SOLUTION

Hi @lauren2021,

 

Try measure as:

Measure = 
SWITCH(
    SELECTEDVALUE('dim table'[subcategory]),
    "Red", CALCULATE(COUNT('Table'[Item Name]),FILTER(ALL('Table'),'Table'[Color]="Red")),
    "Yellow",CALCULATE(COUNT('Table'[Item Name]),FILTER(ALL('Table'),'Table'[Color]="Yellow")),
    "Blue",CALCULATE(COUNT('Table'[Item Name]),FILTER(ALL('Table'),'Table'[Color]="Blue")),
    "Square",CALCULATE(COUNT('Table'[Item Name]),FILTER(ALL('Table'),'Table'[Shape]="Square")),
    "Circle",CALCULATE(COUNT('Table'[Item Name]),FILTER(ALL('Table'),'Table'[Shape]="Circle")),
    "1",CALCULATE(COUNT('Table'[Item Name]),FILTER(ALL('Table'),'Table'[Price]=1)),
    "2",CALCULATE(COUNT('Table'[Item Name]),FILTER(ALL('Table'),'Table'[Price]=2)),BLANK())

Here is the demo: Slicer to Select Column without Unpivoting Table 

 

Best Regards,

Link

 

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

4 REPLIES 4
v-xulin-mstf
Community Support
Community Support

Hi @lauren2021

 

I agree with @amitchandak, you can use bookmark to meet your need.

Here is the output:

v-xulin-mstf_0-1611309270339.png

 

v-xulin-mstf_1-1611309270341.png

 

v-xulin-mstf_2-1611309270344.png

 

v-xulin-mstf_3-1611309270346.png

 

Here is the demo, please try it: Slicer to Select Column without Unpivoting Table

 

Best Regards,

Link

Hi! 

 

This is very similar to what I am looking for, but I was mostly wondering if there was a way to select which column the visual was using for the legend? I've attached a mockup of what it would look like to help explain it better: 

lauren2021_0-1611587794426.png

So right now the user would have 'color' selected so it would be showing the breakdown by color. Then if they selected "Shape," they would see the breakdown by shape. 

 

Do you know if this is possible? (without unpivoting the table)

 

Thanks!

Hi @lauren2021,

 

Try measure as:

Measure = 
SWITCH(
    SELECTEDVALUE('dim table'[subcategory]),
    "Red", CALCULATE(COUNT('Table'[Item Name]),FILTER(ALL('Table'),'Table'[Color]="Red")),
    "Yellow",CALCULATE(COUNT('Table'[Item Name]),FILTER(ALL('Table'),'Table'[Color]="Yellow")),
    "Blue",CALCULATE(COUNT('Table'[Item Name]),FILTER(ALL('Table'),'Table'[Color]="Blue")),
    "Square",CALCULATE(COUNT('Table'[Item Name]),FILTER(ALL('Table'),'Table'[Shape]="Square")),
    "Circle",CALCULATE(COUNT('Table'[Item Name]),FILTER(ALL('Table'),'Table'[Shape]="Circle")),
    "1",CALCULATE(COUNT('Table'[Item Name]),FILTER(ALL('Table'),'Table'[Price]=1)),
    "2",CALCULATE(COUNT('Table'[Item Name]),FILTER(ALL('Table'),'Table'[Price]=2)),BLANK())

Here is the demo: Slicer to Select Column without Unpivoting Table 

 

Best Regards,

Link

 

If this post helps then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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