Forum Discussion
Anonymous
6 years agoNot applicable
Cannot convert Type to Type List
Hello, I want to remove all the records from a table called F_SOURCE_DAILY except the most recent date and the 4 following dates (in total 5 consequal dates) The only field that indicates the da...
- 6 years ago
Hello @RudyWelvaert
you'd have to adjust the syntax to this:
Table. SelectRows (F_SOURCE_DAILY, each each ([FK_DATE] á List. MaxN (F_SOURCE_DAILY[FK_DATE], 5)))
For performance reasons, it would probably make sense to buffer the F_SOURCE_DAILY table before feeding in this step.
Within the 20th argument of Table.Select Rows, the short form [FK_Date] returns the record field (the current row) and not the entire column. Therefore, you must explicitly type the name of the table whose column you want to choose for List.Max.
just a warning: Sort commands in Power Query do not reliably maintain sort order without a buffer: https://community.powerbi.com/t5/Community-Blog/Bug-warning-for-Table-Sort-and-removing-duplicates-in-Power/ba-p/810390
Greg_Deckler
6 years agoCommunity Champion