4 Replies Latest reply on May 18, 2016 3:30 AM by Jan Paulsen

    Combining 2 date fields into 1

    Jan Paulsen

      I have the following data structure:

      1.png

       

      I want to combine Date 1 and Date 2 into the field “Date 1 and Date 2”. However, my output does not behave as expected:

       

      Picture1.png

       

      I have used the following calculation to combine Date 1 and 2:

      If [Value 1] != 0 THEN [Date 1]

      ELSEIF [Value 2] !=0 THEN [Date 2]

      END

       

      Obviously, that does not work. Any ideas? A sample file is attached.

       

      Kind regards,

       

      Jan

        • 1. Re: Combining 2 date fields into 1
          Alastair Young

          Hi Jan,

           

          The reason why you continue to get the wrong answer is that the way the data is detailed.

           

          You have both dates and both values on the same line of data, so the calculation you are processing, is actually giving the correct results as Value 1 is over 0.  the elseif will never trigger.

           

          If you structure the data like this

           

          Date                          Value1          Value2

          04/01/2012                    10                   

          29/01/2012                                            15

           

          Then the response you can get is the following.

           

           

          Is this what you are expecting to achieve?

          • 2. Re: Combining 2 date fields into 1
            Jan Paulsen

            Hi Alastair,

             

            Many thanks for the quick response! Your answer is 100% correct - however, I was hoping to avoid restructuring the data.

             

            I guess there is no way to my the calculation work with the current data?

             

            Cheers

             

            Jan

            • 3. Re: Combining 2 date fields into 1
              Alastair Young

              Jan,

               

              I have been playing with your example and its not immediately clear without amending the underlying data structure.

               

              The Dates are separate which is where the issue lies, you are trying to run it along one date axis but you have 2 and the calculation does not allow for this.

               

              If you have the ability to change the underlying data then I would try that first. You can always create a separate field to distinguish the dates also if needs be.


              Thanks

               

               

              Alastair

              • 4. Re: Combining 2 date fields into 1
                Jan Paulsen

                Thanks a lot!