Forum Discussion

melina's avatar
melina
Helper IV
9 years ago
Solved

Query editor filter the latest date

Hi All,   In my query editor, i have several of files. The files are naming based on <plant_filename_date> In the query editor, there are files from the same plant but different date.   Can i h...
  • MarcelBeug's avatar
    9 years ago

    You can Group By plant with operation "All Rows" and then adjust the generated code to have the maximum date selected.

     

    let
        Source = Table1,
        #"Grouped Rows" = Table.Group(Source, {"Plant"}, {{"AllData", each Table.Max(_,"Date"), type record}}),
        #"Expanded AllData" = Table.ExpandRecordColumn(#"Grouped Rows", "AllData", {"FileName", "Date"}, {"FileName", "Date"})
    in
        #"Expanded AllData"