5 Replies Latest reply: Aug 25, 2011 2:48 PM by Stefan Wühl

# Calculate a % of total by group in a stacked bar

Hi, does anyone know how to create a stacked bar by showing the % of total in each subgroup?  I tried writing this expression but it isn't working for me

sum([TOTAL REVENUE (\$)])/Sum(total<[TOTAL REVENUE (\$)]>[Subgroup])

Thanks!

I'm strugging in that it's creating a % of the entire selection not by quarter and breaking it out

• ###### Calculate a % of total by group in a stacked bar

I think you are almost there:

=sum([TOTAL REVENUE (\$)])/Sum(total<[Subgroup]> [TOTAL REVENUE (\$)] )

• ###### Re: Calculate a % of total by group in a stacked bar

Here is an example for your request for selection of product subgroups using buttons. Look at the properties of the buttons, tab Actions.

• ###### Re: Calculate a % of total by group in a stacked bar

If you want to use wildcards, I think you need a search expression in the button action, like:

='(' & 'A Box*' & '|' & 'B Box parts' & ')'

(Haven't tried with these expressions, but similar ones. If this doesn't work, maybe you could post an updated sample with the new subgroup names)

• ###### Re: Calculate a % of total by group in a stacked bar

Hi, Here's an example - you can see that the search string doesn't seem to be working?

• ###### Calculate a % of total by group in a stacked bar

Yes, I see. I hate this stuff...

What seems to work is

='(' & 'A?Box*' & '|' & 'B?Box?parts' & ')'

i.e. replacing the spaces with wild card ?. It is not exactely the same, so A?Box* would also select A_BoxSomething. But maybe this is ok for you?