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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
Water
Helper II
Helper II

Display difference between previous and following value or date per each occurrence.

I improved on this post and reposted under better Forum after reading how to properly post something. Cannot find a way to delete or close this post. New post is here: Improved post with dataset 

 

Dear Experts, 

 

Please help me with the correct DAX for the following:

 

At Fleet we have many units (vehicles). Each unit has many jobs performed on it at different time or mileage intervals. Each time a job is performed, the date and mileage (Meter 1) is captured. Below are two tables displaying the date and mileage when the different Jobs in the JOB column were performed for one selected vehicle. (There are of course many more vehicles.)

 

Question: I would like to display in the tables the difference between each previous and its following value or date per each job  - and not the actual value. This is to see clearly the interval in which the jobs get performed. This means e.g. with in the mileage table for the first Job 06-02-005, 2021 June should display (147,584-136,011 😃 11,573, and for 2022 July (162,981-147,584=) 15,397.

 

For the date table I hope to display, with the same logic, the number of days difference between each previous and its following date per each job. This means e.g. for the first Job 06-02-005 in the date table, 2021 June should display (2021-06-23 minus 2020-06-17) = 371 (days).

 

All the data is captured in the same WorkOrder table. 

 

You will see jobs are performed over various intervals, ranging from once every 3rd or 4th year, to once every two weeks to everything in between. 

One would typically filter on a specific vehicle to monitor service intervals fro its many jobs, but I would think later groups of vehicles could be combined to see average service intervals for specific jobs.

 

Thank you in anticipation, 

 

Water 

 

Meter 1Meter 1

Date.jpg

3 REPLIES 3
CoreyP
Solution Sage
Solution Sage

Please share a sample of your raw data, and a screenshot of your model including relationships. 

Hi CoreyP.

I improved on this post and reposted under better Forum after reading how to properly post something. Cannot find a way to delete or close this post. New post is here: Improved post with dataset 

 

Thanks, Willem

With pleasure, but how do I upload an Excel sheet?

Below screenshots. From "Unit list" to "WO WITH JOB DETAIL" for the flow of data from unit to jobs. Unit number-field appears in both these tables. 

 

Example.jpg2.jpg

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 NL Carousel

Fabric Community Update - February 2025

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

Top Kudoed Authors