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.

4 Comments

  1. THANK YOU. I could never think of a way to do this and I need it often!!

  2. Thank you this is great, but I have a question. How could I show the first row? I mean the row with the result 10 in column “Value” and Blank in column “Value from Previous Row”

  3. Is there some reason, why we can´t simply keep the first row?

Leave a Reply

Your email address will not be published.

*

clear formPost comment