4 Replies Latest reply: Jan 12, 2011 6:18 AM by Mads Grathe RSS

    Problem with stacked bar chart

    Mads Grathe

      Hi everybody

      I have a problem with constructing a proper stacked bar chart.

      I've gotten as far as the attached image:

      My expression is:



      My problem is twofold:

      1. I'd like the percentages to show the percentage of that month, so for instance in month 201012 it should show 50%, 20%,20% and 10% for the different dimensions instead of 4%,2%,2% and 1%. Is there a way to do this? Note that I'd like to keep the relative difference in the bars so that they don't all go to 100%.

      2. In relation to my note above, I'd like to be able to show the total for each bar, which shows the total count for that month. I've read on the forums that all it takes is to do a second expression with a count and disable the "bar" option and enable the "Text as Pop-up" option in the Display Options of the expression. Only this does not work for me. Instead, my bars just change to a darker colour, which I believe is the 7-12 colors under Data Appearance. Why is this?

      Hope anyone can help. Cheers.

        • Re. :Problem with stacked bar chart
          Martin FAVIER

          For the first problem, change your expression to :


          count(Sales)/count(TOTAL <Month> Sales)

          Where Month is your dimension

            • Re. :Problem with stacked bar chart
              Mads Grathe

              Yes, that's partly true, but then I loose the relative difference between the months:

              Does this mean I can't have my cake and eat it too? :-)

                • Re. :Problem with stacked bar chart
                  Matthew Crowther

                  In order to get your 'Overall Total' for the month you need a seperate Expression to calculate the monthly value - in most cases I would say then to uncheck the 'Bar' Display Option and check 'Values on Data Point' instead as this would then show the value at the top of each bar...however:

                  As you're using percentages of course the total is 100% and if you're performing a count the value won't apply to the Y-Axis, also splitting the axis will change the overall appearance of the chart so as a result my recomendation would be to set the expression, remove the 'Bar' display option and then check the 'Text on Axis' option to show the count value next to each month but completely independent to the chart area.

                  Hope that allows you to gorge on cake.

                  Matt - Visual Analytics Ltd

                    • Re. :Problem with stacked bar chart
                      Mads Grathe

                      Hmmm... Not exactly, but you did get me further than before:

                      Here you see what I mean about the colours changing when I introduce a second expression. Also, the total is not really a total but is also divided into the 4 dimension. It also resulted in my axis label being shifted... I'm confused as to why all this is happening...

                      By the way, I used count(Sales) as the other expression.