Forum Discussion

tfoss78's avatar
tfoss78
Regular Visitor
4 years ago
Solved

Returning latest among multiple dates by row?

Newer user, apologies in advance if I'm missing something basic here.  The table I'm using includes several dates per row corresponding to the receipt of various documents, I am trying to build a cus...
  • v-yanjiang-msft's avatar
    4 years ago

    Hi tfoss78 ,

    There two Table.AddColumn in you code. 

    I get the correct result by add a custom column.

     

    List.Max({[Column1],[Column2],[Column3]})

     

    Here's the whole code below, you can copy-paste in a blank query to see the step.

     

    let
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjIwMtI31zc0UtKBsxFMM6VYHbgaY4S4EZJyC2Q1SOKmCKalUmwsAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t, Column2 = _t, Column3 = _t]),
        #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type date}, {"Column2", type date}, {"Column3", type date}}),
        #"Added Custom1" = Table.AddColumn(#"Changed Type", "Max", each List.Max({[Column1],[Column2],[Column3]}))
    in
        #"Added Custom1"

     

    I attach my sample below for reference.

     

    Best Regards,
    Community Support Team _ kalyj

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.