Forum Discussion
Using Table.Buffer
- 5 years ago
Hi michaelsh
If you buffer a table in a step, then transform that table in some way, then this new transformed table isn't the one that is buffered.
So in subsequent steps you can't continue to refer to the buffered table from your 1st step.
To be honest the workings of the Buffer functions aren't cleary undestood by anyone other than the Microsoft dev team. I've never read a definitive explanation of how or when to use them, hence Pat's suggestion to 'just try them out'.
Cheers
Phil
Hi, michaelsh
You may use 'Table.Buffer'/'List.Buffer' when your table or list will br referenced multiple times(like in 'Table.SelectRows', 'List.Generate', 'List.Accumulate').
In the following example, table 'a' is referenced mutiple times.
=Table.AddColumn(a,"Custom",each Table.RowCount(Table.SelectRows(a,(x)=>x[Subject]=[Subject] and x[Score]=[Score]))+1)
Then you may use 'Table.Buffer' to store the table in memory to improve the performance.
A=Table.Buffer(a),
Table.AddColumn(A,"Custom",each Table.RowCount(Table.SelectRows(A,(x)=>x[Subject]=[Subject] and x[Score]=[Score]))+1)
Hope it helps for you to understand 'Table.Buffer'/'List.Buffer'.
Best Regards
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-alq-msft Could you please explain why buffering once is not enough? Why does one need to repeatedly buffer a table if it 'is referenced multiple times' as you say?