4 Replies Latest reply on Jun 20, 2018 10:26 AM by Deepak Rai

    Calculated field returning incorrect number of records




      I created a status tracker by using an excel data set and pivoting the fields in tableau. I would like to see the number of times a project has been opened and closed so I used the following calculated field:


      If [Pivot Field Name] = 'Open Date'


      Then [Number of Records] End




      If [Pivot Field Name] = 'Close Date'


      Then [Number of Records] End


      However these calculated fields return the incorrect number of records. The open date calculated field will count the date a project was inputted so if there were 3 open dates and 1 input date it will count "4". Similarly the Close date will count 1 more than how many closed dates there were. For example if there were 3 close dates the calculated field will return "4"




      My dates below:


      Project       Input Date     Open Date        Close Date  

      1                   1/1/17       2/1/17                5/1/17            

      1                   1/1/17         3/1/18                6/1/18   

      2                    2/1/16        4/1/16                 12/1/16

      2                    2/1/16        5/1/17                   8/1/17


      Any idea as to why this is occurring?