Forum Discussion
Power Query only load filtered rows
In addition. Not repeat in Power Query exactly the same set of filters as in Excel table you may add helper column to the Table as
=(AGGREGATE(3,5,[@A])=1)+0
there [A] is any column within the table assuming it has no blank values. Similar could be for the range. Formula returns 1 for visible rows and 0 for hided ones.
Within the PowerQuery as first steps filter result on zero for this column and remove it. That shall work for any filter applied in Excel sheet.
- gvpiper777May 08, 2021Copper Contributor
SergeiBaklan Thank you for this - a really neat solution - has helped me enormously solve a problem
- SergeiBaklanMay 08, 2021Diamond Contributor
I'm not an author, it's known for a long while. In any case glad it helped.
- Paul_McCormackNov 25, 2020Copper ContributorLove this! I can now get rid of some fiddly VBA code which copies selected table records across to a new table.
- JKPieterseApr 16, 2020Silver ContributorDevious. I must study that AGGREGATE function more!
- SergeiBaklanApr 16, 2020Diamond Contributor
- JKPieterseApr 16, 2020Silver ContributorBack in the day that didn't work because filtering did not necessarily trigger a calculation
- Mischa2710Apr 16, 2020Copper Contributor
- Mischa2710Apr 16, 2020Copper Contributor
A good idea ... I´m going to try it. A problem could be that the filtered table is already a PQ table. So if I refresh the table the help column could disappear. But I´ve to test it.
Thanks for helping
- SergeiBaklanApr 16, 2020Diamond Contributor
If you add helper column to the table returned by PQ such column won't disappear but it isn't in sync with the table. Not very important in this case since we use any value in current row.
But I didn't catch how entire model works. You have some source data, transform it by Power Query and return the table to the sheet. Apply filtering to the resulting Table, query now this table and return result into one more table. Like this?
- Mischa2710Apr 16, 2020Copper Contributor
absolutely correct.