Forum Discussion

kimbtoth's avatar
kimbtoth
Frequent Visitor
3 years ago
Solved

Return a Value based on other rows

I am trying to combine data from our old system with our new one.  The commonality is the account number which will stay the same.  I want to update my spreadsheet so that if there was a date record...
  • v-yalanwu-msft's avatar
    3 years ago

    Hi, kimbtoth ;

    You could try it.

    Then expand it and delete it.

    let
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("bYxBDgAhCAP/wlkSQJT4FuP/v+GJpdl4a6bT7k1q3amRiSkHK52GzNh5IMs8YfMJAUKksOp0Ve+SvUo9uIHR0Ug4nrP5o+cC", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Account Number" = _t, #"Date ACE Completed" = _t]),
        #"Changed Type" = Table.TransformColumnTypes(Source,{{"Account Number", Int64.Type}, {"Date ACE Completed", type date}}),
        #"Grouped Rows" = Table.Group(#"Changed Type", {"Account Number"}, {{"maxdate", each List.Max([Date ACE Completed]), type nullable date}, {"a", each _, type table [Account Number=nullable number, Date ACE Completed=nullable date]}}),
        #"Expanded a" = Table.ExpandTableColumn(#"Grouped Rows", "a", {"Date ACE Completed"}, {"a.Date ACE Completed"}),
        #"Removed Columns" = Table.RemoveColumns(#"Expanded a",{"a.Date ACE Completed"})
    in
        #"Removed Columns"


    Best Regards,
    Community Support Team _ Yalan Wu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.