4 Replies Latest reply on Nov 6, 2015 9:10 AM by JT Holland

    Find the minimum date across four fields, if null use fifth date.

    JT Holland

      Good morning Tableau Community!


      I have a report, in it I need to group rows by looking at four date columns, finding the lowest one while ignoring any null values. If all four fields are null, then I should use a fifth date column. The MIN function is limited to two expressions, I've tried to create a CASE function but to no avail. I wonder if someone far smarter than I can lend a hand?


      So, if data looks like this:

      Id    Col1    Col2    Col3    Col4    Col5
      1    1/1/15   Null     Null     Null   1/2/15
      2     Null      Null     Null     Null   2/2/15
      3     Null      Null   5/4/15   Null   5/1/15
      4    2/1/15   Null     Null     Null   7/2/15
      5    8/8/15  8/16/15 Null    Null   3/2/14


      The end result should be:
      Id    Value
      1     1/1/15
      2     2/2/15
      3     5/4/15
      4     2/1/15
      5     8/8/15


      I'm fairly certain that once I get to this point I can figure out the sorting/grouping part, but it's getting the four (or five) fields down to a single value that's proven to be a tough one for me.