Forum Discussion
Filter on last row for each article
- 1 year ago
Hi joshua1990 Could you try this please
Remove Unnecessary Columns:
- Select master data columns and use Remove Other Columns.
Sort by Article and Year-Week:
- Sort Article (ascending) and Year-Week (descending).
Group by Article:
- Go to Home → Group By:
- Group by Article and choose All Rows.
- Go to Home → Group By:
Keep the Latest Row:
- Add a custom column with:Table.FirstN([All Data], 1)
- Expand the table to show required fields.
- Add a custom column with:
Add "Last Entry" Column:
- Create a column for Year-Week and rename it Last Entry.
If this post helped please do give a kudos and accept this as a solution
Thanks In Advance
- Create a column for Year-Week and rename it Last Entry.
- 1 year ago
From
Using
let Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content], #"Changed Type" = Table.TransformColumnTypes(Source,{{"Year-Week", type date}, {"Article", type text}, {"Team", type text}, {"Country", type text}, {"Department", type text}, {"Group", type text}}), #"Grouped Rows" = Table.Group(#"Changed Type", {"Article"}, {{"Rows", each Table.Last(_)}}), #"Expanded Rows" = Table.ExpandRecordColumn(#"Grouped Rows", "Rows", {"Year-Week", "Team", "Country", "Department", "Group"}, {"Year-Week", "Team", "Country", "Department", "Group"}) in #"Expanded Rows"To
Did I answer your question? Then please (also) mark my post as a solution and make it easier to find for others having a similar problem.
Remember: You can mark multiple answers as a solution...
If I helped you, please click on the Thumbs Up to give Kudos.Kees Stolker
A big fan of Power Query and Excel
- 1 year ago
Hi joshua1990 , here's a solution you could look at. In case of any clarifications or if I haven't got your query correctly, don't hesitate to correct me or ping back. I'll attach the image of the code below. Thanks!
From
Using
let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Year-Week", type date}, {"Article", type text}, {"Team", type text}, {"Country", type text}, {"Department", type text}, {"Group", type text}}),
#"Grouped Rows" = Table.Group(#"Changed Type", {"Article"}, {{"Rows", each Table.Last(_)}}),
#"Expanded Rows" = Table.ExpandRecordColumn(#"Grouped Rows", "Rows", {"Year-Week", "Team", "Country", "Department", "Group"}, {"Year-Week", "Team", "Country", "Department", "Group"})
in
#"Expanded Rows"
To
Did I answer your question? Then please (also) mark my post as a solution and make it easier to find for others having a similar problem.
Remember: You can mark multiple answers as a solution...
If I helped you, please click on the Thumbs Up to give Kudos.
Kees Stolker
A big fan of Power Query and Excel