Mark M
Mark M

Reputation: 525

Allow users turn colour breakdown / legend on and off on a bar chart

Is there a way to allow users turn on/off the colour breakdown on bar charts? I'm thinking like a slicer, but just for having the bar coloured by Products rather than actually filtering for one product.

My users have said they find it easier to look at the complete totals when there's no colours, but still want to see the splits as a stacked bar chart. Right now I've got two versions of a few bar charts which is very wasteful for space.

chart switching

Data used to make the chart is:

Product   Sales
a         2
b         4
c         3

Upvotes: 0

Views: 239

Answers (2)

Karl Anka
Karl Anka

Reputation: 2849

One workaround that could be feasible given your table is not too big is to create a new table:

Product Sales
a       2
c       3   
b       4   
All     9   

Using this formula:

SalesTable_2 =
UNION (
    Product_Sales;
    ROW ( "Product"; "All"; "Sales"; SUM ( SalesTable[Sales] ) )
)

Then add a helper columncat_filt = IF(Product_Sales_2[Produc] = "All";"All";"Separate"):

Product Sales   cat_filt
a       2       Separate
c       3       Separate
b       4       Separate
All     9       All

Then add a slicer with select one only-option enabled on cat_filt:

enter image description hereenter image description here

This will obviously duplicate your data so the better option would be to add this total row outside of PBI/Dax.

Upvotes: 1

Andrey Nikolov
Andrey Nikolov

Reputation: 13450

This isn't turning on or off. This is a change of the value - 3 separate values in stacked chart or one value (the total). So you can make a copy of this report page, where the fields in this visual are different (categories or total) and use bookmarks to switch between these 2 report pages.

Upvotes: 1

Related Questions