1 Reply Latest reply on Dec 15, 2016 4:23 AM by Dhruv Gupta

    How do I Count IF from multiple columns

    Andrew Maclachlan

      Hi All,


      I am trying to create a calculated field that is SUM of a number of conditions from other columns. I've recreated something similar to what I have below. I'm trying to create Tool Count and have the columns Tool1/2/3. I've filled in what I would like to see in Tool Count


      Tool 1
      Tool 2
      Tool 3
      Tool Count


      I have solved this by creating a column for each Tool called Tool 1 Int etc...


      IF [Tool 1] = "Y"

      THEN 1

      ELSE 0



      ...and then a final column Tool Count


      [Tool 1 Int] + [Tool 2 Int] + ..... etc


      to get the total.


      This is messy as I have to create an additional column for each Tool I am counting and I would like to have all this in one calculated field. I'm new to Tableau and I'm sure it's simple. I've put the pseudo code of what I would like below:


      define int toolCount


      IF [Col 1] == "Y"

      THEN toolCount += 1

      IF [Col2] == "Yes"

      THEN toolCount += 1