Loading, please wait...

A to Z Full Forms and Acronyms

Steps to Get Previous Row Value From Column | Deep Dive Into PowerBI

In this article we will learn how to get previous row value from column and insert in next row of different column

Steps to Get Previous Row Value From Column| Deep Dive Into PowerBI

The previous article of this series was about How to Calculate the Sum of Sales between Two Dates using New Measure. If you want to read the previous article click on the Link

In this article, we will learn how to get previous row value from the column and insert in the next row of different columns. This task will help you guys when we compare columns or row values for some specific operations.

Let's start

Firstly we look at our data, on which column, we performing this task. In this data we have a column name 'Sold Units', we perform an operation on it. I show you the data in the picture below.

We divide this operation into a two-step

  1. Step 1:- add a new index column, follow the below steps. This is very important because we using index value into the DAX function to perform this task.

    Click on transform data, after that power query window is opened.
     
    Again click on add column, then ribbon option will change
     
    now click on an Index column, pop up will ask you index value start from 0 or 1. Personally in use index value from 0.
     
    Finally, you add the index column into your data with name index1, you can change the name of the index column.
     
  2. Step 2:- Now it's time to create a custom column using LOOKUPVALUE DAX function.

    Click on the 'custom column'. Custom column windows opened, Write your Dax function here.

DAX function

PrevRowUnit=LOOKUPVALUE([Units Sold],[Index.1],[Index.1]-1)+0

The custom column is finally created.

After completing all above step plot your data on table visual

You can see your task is completed.you can see dashboard look like

A to Z Full Forms and Acronyms

Related Article