Power Query M language – get value from previous row
This tutorial shows how to get the value from previous (or next or something like this...) row in Power Query or Power BI queries.
I mean if you have a table like this:
and need values from previous rows, like this:
How to do it?
First you need the index column:
Then add 1 (if you want to move one row back):
Then merge the table with itself. The key are the original and moved index.
Click on the doublesided arrow at the header and show the original value from connected query.
Remove the indexes and that´s all.