7 Replies Latest reply: Sep 13, 2016 11:43 AM by Sunny Talwar RSS

    Stacked Bar Chart Percentage

    Matt Melhus

      Hello -

       

      I'm trying to get my stacked bar chart to display as a percentage.  I'm able to get the proper count values to display in the chart, but can't figure out what expression i would use to turn them into a percentage.

       

      Both methods get me the proper counts

       

      (single dimension with 2 measures):

      Dimension:

      Name

      Measures:

      Count({$<PrepQualityScore= {Acceptable}>} distinct Procedure)

      Count({$<PrepQualityScore= {Unacceptable}>} distinct Procedure)

       

      Two dimensions with singe measure:

      Dimension:

      Name

      PrepQualityScore

      Measure:

      Count(distinct Procedure)

       

      Any and all help is greatly appreciated.

       

      Matt

        • Re: Stacked Bar Chart Percentage
          Sunny Talwar

          May be try this as expression:

           

          Dimension:

          Name

          PrepQualityScore


          Measure:

          Count(DISTINCT Procedure)/Count(DISTINCT TOTAL <Name> Procedure)

           

          Assuming Name is your first dimension, this will give 100% for each of the bar (Name on the x-axis)

            • Re: Stacked Bar Chart Percentage
              Matt Melhus

              That did get me to 100%; however, not the exact result I'm looking for.  I apologize, let me try and clarify the request.

               

              For PrepQualityScore there are two values. Either Acceptable or Unacceptable.  When I create a stacked bar chart with Dimension as Name and PrepQualityScore and with a Measure =Count(distinct Procedure), I get something like the following:

               

              X-Axis:  Name1,  Name 2, Name 3

               

              Y-Axis:  (50 Acceptable,25 Unacceptable),  (60 Acceptable,20 Unacceptable), (20 Acceptable,30 Unacceptable)

               

              What I would like is if I could get the Y-Axis to show something like

               

              Y-Axis:  (67% Acceptable,33% Unacceptable),  (75% Acceptable,25% Unacceptable), (40% Acceptable,60% Unacceptable)

               

              I've tried a bunch of things but can't seem to get it to work. I'm likely way over thinking this.  Example of my latest failed attempt:

               

              (Count({$<PrepQualityScore= {Acceptable}>} distinct Procedure)/ Count(total <PrepQualityScore> distinct Procedure)) + (Count({$<PrepQualityScore= {Unacceptable}>} distinct Procedure) / Count(total <PrepQualityScore> distinct Procedure))