2 Replies Latest reply on Aug 17, 2018 7:21 AM by Elaine Walsh

    bar graph color based on value

    ROHIT CHATURVEDO

      Hi,

      Have a requirement to create a bar graph for current year and last yer value. If the growth is +ve then the current year bar should be green and last year value should be in red and if the growth is -ve  then the current year bar color should be red and last year bar color should be light red. How i can achieve this?

       

      If you have any improved suggestions please let me know.

       

      Thanks

        • 1. Re: bar graph color based on value
          Mahfooj Khan

          Hi Rohit,

           

          Lets assume you've data like this

          Then you need to create a calculated field to get the

           

          Growth:

          (SUM({FIXED [Country]: SUM(IIF([Period]="This Year",[Value],0))})-

          SUM({FIXED [Country]: SUM(IIF([Period]="Last Year",[Value],0))}))/

          SUM({FIXED [Country]: SUM(IIF([Period]="Last Year",[Value],0))})

           

          Now create calculation to get the threshold colors

          Color 1:

          IF [Growth]>0 AND ATTR([Period])="This Year" THEN "Green"

          ELSE "Red"

          END

           

          Color 2:

          IF [Growth]<0 AND ATTR([Period])="This Year" THEN "Red"

          ELSE "Light Red"

          END

           

          then drag the fields like this. Only catch you need to select both color calculated fields together then put it on color marks. Then assign color as per attachment.

          Workbook v10.5 attached for your reference. Let us know if this help.

           

          Mahfooj

          • 2. Re: bar graph color based on value
            Elaine Walsh

            Thank you, great help to me!

             

            Elaine