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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
Anonymous
Not applicable

How do I make a slicer that slices my visual by the legend?

Hello, 

I am new to Power BI and I am trying to figure out how to create a slicer that slices my bar graph visual by the legend of the visual. For example if I deselect one of the legend fields, the values associated with the field disappear from the visual.

Please let me know if you need more clarification.

2 ACCEPTED SOLUTIONS
aj1973
Community Champion
Community Champion

@Anonymous 

It looks like you need to unpivot your Table in Power Query.

 

Regards
Amine Jerbi

If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook

View solution in original post

Anonymous
Not applicable

I would add that Power BI is a tabular model meaning you will need a date column.  Having dates on columns can be difficult to work with.

In Power Query you can transform a table and use the unpivot feature, which is super handy.

I would also mention switch is a powerful function within Power BI, but may not be suited for this case. 

View solution in original post

8 REPLIES 8
aj1973
Community Champion
Community Champion

Hi @Anonymous 
Yes we need more clarifications like screenshots or maybe a sample Pbix would be even better

 

Regards
Amine Jerbi

If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook

Anonymous
Not applicable

Yes, I couldn't figure out how to upload a file onto this reply so here is a screenshot. I would like to get the legend as a slicer so I can slice by date. Screenshot (5).png

Anonymous
Not applicable

1. There is a slicer icon in the visuals that you can drop into the report. 
2. Then drop the field you would like to slice into the slicer.
3. There is a down arrow in the right corner that can be selected to change the way the slicer works. 


Video on how to add slicers: 
Power BI - Slicer - YouTube

Thank you,

Jeffrey Eschright

Anonymous
Not applicable

The problem I am encountering with that method is that when I add a date into the slicer it doesn't allow me to deselect the date entirely, just the values associated with that date, as you can see here. 
Screenshot (6).png

aj1973
Community Champion
Community Champion

@Anonymous 

It looks like you need to unpivot your Table in Power Query.

 

Regards
Amine Jerbi

If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook

Anonymous
Not applicable

I would add that Power BI is a tabular model meaning you will need a date column.  Having dates on columns can be difficult to work with.

In Power Query you can transform a table and use the unpivot feature, which is super handy.

I would also mention switch is a powerful function within Power BI, but may not be suited for this case. 

aj1973
Community Champion
Community Champion

In your table do you have a column date?

what do you expect to see when you added the dates to the Values field?

You can use slicer for the dates outside the Graph.

Can you share your Pibx as is through One drive or google drive or any cloud service?

 

Regards
Amine Jerbi

If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook

Anonymous
Not applicable

Hi @Anonymous,

Currently the native graphs that come with Power  BI Desktop allows the user to select a legend item within the graph and spotlight or showcase only those specific items.  It will only highlight or grey out the items unselected. 

My suggestion would be to create a chicklet slicer (downloadable from more visuals) or use a slicer for the legend item in place of the legend itself. (Fastest Solution)

 

There are ways to modify graphs using DAX or creating new visuals in python as well.

Regards,
Jeffrey Eschright

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

March2025 Carousel

Fabric Community Update - March 2025

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

Top Solution Authors