6 Replies Latest reply on Oct 9, 2017 10:03 PM by Hari Ankem

    Countifs to use to color

    jessica.youngberg

      I'm on Tableau Server 10.3.1, connecting to a PostgreSQL source that consists of multiple joined tables. My question uses data in a single table though.

       

      Each row is associated with a state but the widget id repeats across multiple states. I'd like to make a calculated field that gives a 1 whenever the widget appears in CA, even if the actual row is a different state. This is so I can use it in color-coding a scatterplot.

       

      The data look like this:

      widget
      stateis it in CA? (=COUNTIFS(A:A,A2,B:B,"CA"))
      abcAL1
      abcCA1
      abcTX1
      defAL0
      defTX0
      ghiAL1
      ghiCA1
      jklTX0

       

      I did this in Excel using a countifs (=COUNTIFS(A:A,A2,B:B,"CA")) but can't figure it out for Tableau. The tutorials I've found boil down to renditions of countd: I want to apply the CA data to other rows, and the suggestions mostly just counted up CA rows.

       

      Plan B is to export the data and do it in Excel, then re-upload, but surely there's another method!

       

      This discussion looked promising, but the answer involves joins. As I just have Server access, this method is about as useful as exporting to Excel and reuploading.

      I tried Mark Jackson's formula here and basically just counted the CA rows.

       

      Message was edited by: Jessica Youngberg to add tutorials I had used