Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Get difference between values in a column preceding each other by date

Hi,

I have a scenario that i want to apply.

I want to create a new column that holds the difference between each 2 preceding values based on date.

for example :-

 

Date                     Value              Difference

15/5/2021              125                    0

19/5/2021              127                    2

20/5/2021              134                    7

23/5/2021              135                    1

 

and so on ..

 

Please, How can i achieve this ? i want to plot it on a line chart also based on the calculated column.

Thank you in advance.

 

 

1 ACCEPTED SOLUTION

Hi, @Anonymous 

I have one question.

There were two lines found that indicate the same information except the Record.

For instance,

2020 Oct 1st -> CAE-HQ 

Two records are found (6625 and 8184). May I ask how to differentiate these? Or, can I just sum up?

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

9 REPLIES 9
daxer-almighty
Solution Sage
Solution Sage

@Anonymous 

 

This calculation belong to Power Query, not DAX. Just to let you know. If your table is big (think: fact table), the calculation given by @Jihwan_Kim will be way too slow due to context transition(s).

Jihwan_Kim
Super User
Super User

Hi, @Anonymous 

Please check the below picture and the sample pbix file's link down below, whether it is what you are looking for.

I created a new column, and it is not a calculated measure.

 

Picture3.pngPicture4.png

 

https://www.dropbox.com/s/rqys8dykshli41w/mamr.pbix?dl=0 

 

Hi, My name is Jihwan Kim.

If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.
Anonymous
Not applicable

Hello @Jihwan_Kim 

Thank you very much for your responsive reply.

I have applied the query you have mentioned, But i get some strange values, that are presented in the attached screenshot.

 

I make a filter on specific "Account" column to "Al Futtiam Comme" to validate the results on the line chart.

 

Data.png

 

 

Hi,

Thank you for your feedback.

The reason is that the table structure is different between the sample shown in your first question and the screenshot. 

If it is OK with you, please share your sample pbix file's link, then I can try to come up with a more accurate solution.

 

Thanks.


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.
Anonymous
Not applicable

Hello @Jihwan_Kim 

Thank you very much.

This is the link for my pbix file.

https://drive.google.com/file/d/1GzdNxzjOXTco0DaBFf_S7Hvl5CKh7ngP/view?usp=sharing

Thank you in advance.

Hi, @Anonymous 

I can download your pbix file, but I cannot connect to your source, and cannot see your data properly.

I think you should make a new sample file. 

For instance, copy the table, and create a new pbix file, paste the table into the new pbix file, then delete some of the importance information, then share the new pbix file's link.


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.
Anonymous
Not applicable

Hi @Jihwan_Kim 

You are right.

Here is the sample pbix file link.

https://drive.google.com/file/d/14lYQe8lJqftpCC4edo7Nz8jb5gNt9Yly/view?usp=sharing

Thank you in advance.

Hi, @Anonymous 

I have one question.

There were two lines found that indicate the same information except the Record.

For instance,

2020 Oct 1st -> CAE-HQ 

Two records are found (6625 and 8184). May I ask how to differentiate these? Or, can I just sum up?

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.
Anonymous
Not applicable

Hello @Jihwan_Kim 

I really thank you for your responsive reply.

I have solved the issue by getting also the specific time with the date, so there is no duplication in the data structure as you said.

Great respect for your support.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.