How can I get a column value from previous row in Power Query?

人盡茶涼 提交于 2019-11-30 00:01:52

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!