Difference between two rows in Power BI

Hello friends! today we’ll be learning how to calculate difference between two rows from same columns in Power BI. Easy to follow tutorial and reusable Power BI file is uploaded to GitHub repository

Recently I got the requirement to calculate the daily sales in Power BI whereas the data contained the cumulative sales on daily basis.

Data was in the following structure

DateCumulative Sales
9/17/202140
9/18/202169
9/19/2021108
9/20/2021147
9/21/2021168
9/22/2021205
9/23/2021228
9/24/2021254
9/25/2021269
9/26/2021294
9/27/2021316

Step 1 – Sort the data based on date column

Step 2 – Add the index 2 index columns From 0 and From 1 both as shown in the image below

Once the index columns added it will look something like below.

Step 3 – Merge table to self with Index columns. Select Index 0 column and Index.1 column and Left outer join as shown in the image below.

Step 4 – Creating a new column for daily sales as shown in the image below.

Keep visiting Analytics Tuts for more tutorials.

Thanks for reading! Comment your suggestions and queries


6 comments

Leave a Reply

Your email address will not be published. Required fields are marked *