4 Replies Latest reply on Mar 21, 2018 3:28 PM by vibol chea

    How can I get the most recent record using LOD?

    vibol chea

      Hello Tableau Wiz,

       

      I need help with getting the most recent Phone from our database by Acct, Phone type, and most recent update Date.

       

      Acct         PhoneType          Update Date          Phone Number

      1111          Cell                       01-01-2017          111-111-1111

      1111          Cell                       05-25-2016          555-555-6666

      1111          Cell                       03-20-2018           222-222-2222           

      1111          Home                    02-10-2015          444-354-2325

      5555          Cell                        05-05-2017          333-252-5252

       

      So the result should look like this:

       

      Acct          PhoneType          Update Date          Phone Number

      1111          Cell                       03-20-2018           222-222-2222           

      1111          Home                    02-10-2015          444-354-2325

      5555         Cell                       05-05-2017          333-252-5252

       

      I have this LOD but it's not the result I want.  It's giving me the max phone number instead of the max date.

       

      { FIXED  Acct: MAX(IF  ([Phone Type]='Cell') and {fixed [Phone Type]: max([Update Date]=[Max Update Date])} THEN [Phone Number] end ) }