Forum Discussion
Latest Value per Article
- 3 years ago
Hi,
Here is one way to do this:
Example data:
1. Duplicate the query for use in step 3
2. Group the query by date and article:
#"Removed Other Columns" = Table.SelectColumns(#"Sorted Rows",{"Date", "Article"}),
#"Grouped Rows" = Table.Group(#"Removed Other Columns", {"Article"}, {{"LatestDate", each List.Max([Date]), type nullable date}})
in
#"Grouped Rows"3. Merge the grouped query and filter nulls away after expanding:
#"Merged Queries" = Table.NestedJoin(#"Sorted Rows", {"Date"}, #"Table (27)", {"LatestDate"}, "Table (27)", JoinKind.LeftOuter),
#"Expanded Table (27)" = Table.ExpandTableColumn(#"Merged Queries", "Table (27)", {"LatestDate"}, {"LatestDate"}),
#"Filtered Rows" = Table.SelectRows(#"Expanded Table (27)", each ([LatestDate] <> null))
in
#"Filtered Rows"
4. End result:I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!
My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/
Hi,
Here is one way to do this:
Example data:
1. Duplicate the query for use in step 3
2. Group the query by date and article:
#"Removed Other Columns" = Table.SelectColumns(#"Sorted Rows",{"Date", "Article"}),
#"Grouped Rows" = Table.Group(#"Removed Other Columns", {"Article"}, {{"LatestDate", each List.Max([Date]), type nullable date}})
in
#"Grouped Rows"
3. Merge the grouped query and filter nulls away after expanding:
#"Merged Queries" = Table.NestedJoin(#"Sorted Rows", {"Date"}, #"Table (27)", {"LatestDate"}, "Table (27)", JoinKind.LeftOuter),
#"Expanded Table (27)" = Table.ExpandTableColumn(#"Merged Queries", "Table (27)", {"LatestDate"}, {"LatestDate"}),
#"Filtered Rows" = Table.SelectRows(#"Expanded Table (27)", each ([LatestDate] <> null))
in
#"Filtered Rows"
4. End result:
I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!
My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/