Forum Discussion
PowerQuery: Filter Top N
In Power Query, is there an equivalent function to filter top N items.
What I'm trying to do is filter on the latest 7 days and they don;t have to be consecutive days - just the latest 7 days available in the records.
How can this be done?
- Anonymous8 years ago
HI ovetteabejuela,
You can refer to below steps to filter the dynamic last 7 days:
1. Add custom steps to find out the last date from current table.
Custom1 = List.Max(#"Changed Type"[Date])
2. Enable date filter on date column and use above variable as the parameter.
#"Filtered Rows" = Table.SelectRows(#"Changed Type", each [Date] >= Date.AddDays(List.Max(#"Changed Type"[Date]),-7))
Filtered tableOriginal tableRegards,
Xiaoxin Sheng
2 Replies
- AnonymousNot applicable
HI ovetteabejuela,
You can refer to below steps to filter the dynamic last 7 days:
1. Add custom steps to find out the last date from current table.
Custom1 = List.Max(#"Changed Type"[Date])
2. Enable date filter on date column and use above variable as the parameter.
#"Filtered Rows" = Table.SelectRows(#"Changed Type", each [Date] >= Date.AddDays(List.Max(#"Changed Type"[Date]),-7))
Filtered tableOriginal tableRegards,
Xiaoxin Sheng
- parry2kSuper User
you can create a column using rank function and then filter on this new column