问题
I want to get a value from the previous row.
I tried the following code as suggested in this post:
Table.AddColumn(#"Added index", "custom column", each {[Index]-1}[column name])
But it throws this error:
Cannot use field access fot type List
Please help, what am I doing wrong?
回答1:
The error comes because {[Index]-1}
without anything before it is a list value, but instead you want to index into a row of a table with this syntax: MyTable{index}
That looks like:
= Table.AddColumn(#"Added index", "custom column", each #"Added index"{[Index]-1}[My Column])
来源:https://stackoverflow.com/questions/44053365/how-can-i-get-a-column-value-from-previous-row-in-power-query