2 Replies Latest reply on May 25, 2017 11:41 PM by Adam Nieradzik

    Bars colors based on Threshold category

    Adam Nieradzik

      Hi,

       

      I would like to create a bar graph which would show me different color per category based on threshold volume. (below threshold green, in between amber, above red)

       

      Let's assume that my data looks like this.. where i have a Group name and a sum of objects in that group which in my real data would be number of records.

       

      Group# of objectsThreshold 1Threshold 2
      A25520
      B202530
      C151020
      D10511

       

      Now, based on the threshold size i would like to have RAG i.e.

      IF Group='A' AND [# of objects] <5 THEN ;GREEN'

      ELSEIF Group='A' AND [# of objects] >=5 and <= 20 THEN 'AMBER'

      ELSEIF Group='A' AND [# of objects] >20 THEN 'RED'

       

       

      Do you have guys any idea how to achieve it via tableau ? I can't do a case statement as this doesn't allow to mix up strings and integers.

       

      Thank you in advance.

      Kind Regards,

      Adam

        • 1. Re: Bars colors based on Threshold category
          Zhouyi Zhang

          Hi, Adam

           

          you can create a calculation field as below:

           

          IF [# Of Objects]< [Threshold 1] THEN

              "Green"

          ELSEIF [# Of Objects]>= [Threshold 1] AND  [# Of Objects]<=[Threshold 2] THEN

              "Amber"

          ELSEIF [# Of Objects] > [Threshold 2] THEN

              "Red"

          END

           

           

           

           

          Workbook attached for your reference.

          Hope this could help

           

          ZZ

          1 of 1 people found this helpful
          • 2. Re: Bars colors based on Threshold category
            Adam Nieradzik

            Thanks for this,

             

            What if the threshold value is not in my data source ? I.e. it is pretty much subject to change from time to time hence it has to be inserted manually into the calculated field. Also for each GROUP it is a different value i.e look at previous example.

             

            So my data would like below - with a minor difference that it would be thousands of records and around 10 groups.

             

            Group# of objects
            A25
            B20
            C15
            D10

             

             

            Thank you ,

            Regards

            Adam