3 Replies Latest reply on May 28, 2016 10:26 AM by Seb Bec

    compare a value

    Seb Bec

      I have 3 columns

      Low, High, Total

      The totals are
      displayed  SUM(total), also I enable the
      abd/123 Label so the value is displayed at the end of the graph (bar).

      How can I compare the Total with the range? in other words,
      if the total is lower or higher than values stated by Low/High, turn label red.

      O any other way just to let me know that total is outside
      the range.

      many thanks

        • 1. Re: compare a value
          Mahfooj Khan

          I dont know about your data structure. It will be more helpful If you share some sample data in text format or the workbook in .twbx format. I think I can help you.

          Lets assume your columns are measures then you can create a calculated field like this

          IF SUM([Total])>SUM([High]) THEN 'Red'

          ELSE 'Green'

          END

          Drag this calculated field to color in Marks card and manually change the color of the legends.

           

          Mahfooj

          • 2. Re: compare a value
            Carl Slifer

            Hi Seb,

             

            It appears that your Low and High Columns are there as thresholds for an acceptable range. In this case your formula is going to look a bit different.

             

            SUM([Total]) <= SUM([High]) AND SUM([Total]) >= SUM([Low])

             

            This will return a Boolean where it returns true if you're inside the range and false outside the range. You then need to bring this field to the colours shelf of your marks card and change false to red and true to green.

             

            If you prefer to use logic instead of a boolean try this

            IF SUM([Total]) <= SUM([High]) AND SUM([Total]) >= SUM([Low]) THEN 'Green' ELSE 'Red' END

             

            Cheers!

            Carl Slifer

            InterWorks

            1 of 1 people found this helpful
            • 3. Re: compare a value
              Seb Bec

              Many thanks  Carl,

              This is exactly what I needed.  I used the logic way and worked perfectly.

              When beginning to use Tableau everything seems complicated but
              little by little, it is making sense.

              thank you again!

              Seb.