4 Replies Latest reply on Nov 16, 2016 3:38 PM by Amanda Lamb

    Calculate field based using parameters and table calculations

    Amanda Lamb

      Hello, I'm still relatively new to Tableau, so please forgive me if this is a simple question and I am missing something. Here is what I would like to have happen:

       

      When the bars are above the reference line (which is set at "1"), the bar changes color.

      The complication

      Normally, this would be a really simple calculated field (IF >1 THEN "More", ELSE "Less" END; move that field to "color" mark). But I can't get that to work because of the parameters and table calculations that create those bars.

       

      The bars are based on the parameter "choose sentence". The parameter options are

      • Prison
      • Jail
      • Probation
      • Fine/Fee

       

      The complication is that the bars are based off a series of table calculations. You can see how I learned (via this community) to create those calculations in this forum discussion. The calculations require that I

      1. Create a "grand total" for all sentenced cases (sum prison + jail + probation + fine/fee, roughly)
      2. Create a "rate" for each sentence bucket (sum prison / grand total sentenced cases)
      3. Calculate a relative rate by dividing the rate of people of color with the rate for white people.

       

      The results look something like this (this one is for jail bookings):

      This gets me the "relative rate of disparity" in sentencing. In the screenshot above, for instance, black defendants were 1.34 times more likely than white defendants to be sentenced to prison in 2014.

       

      Back to the question: How can I get those bars to change color? I've attached this sheet of the project, if that helps.