1

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?

MrDark
  • 67
  • 2
  • 3
  • 12

1 Answers1

11

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])
Carl Walsh
  • 6,100
  • 2
  • 46
  • 50