Finding the Date of the Next Record in Power Query

Today I’m going to share my solution to a question I found on the MrExcel forum. It’s an interesting problem.

https://www.mrexcel.com/board/threads/power-query-to-determine-consecutive-and-non-consecutive-dates.1261496/

Let me briefly explain the problem.

The Problem

We have the following table, which contains the source data.  Each row contains a unique ID (maybe a piece of equipment) and failure dates; each failure date in a new column.

Input

So, for ID 123, a failure occurred on the 17th of June and again on 19th June. Because the dates are not consecutive (week days), they are treated as 2 events.  Then the event on 19th June is followed by an event on 20th, 21st (Friday), 24th (Monday).  All these dates were the same event.  Failure first occurred on the 19th and the last failure was the 24th.

The Required Output

The objective from the OP is to transform the table above into the below format.

Final Output

The Solution

I have recorded the following video showing you how I solve this problem.  I’ve used many tricks that I have learnt over my years using and teaching Power Query.

This solution is very similar to a previous video I created here, if you are interested. https://www.youtube.com/watch?v=xN2IRXQ2CvI

 

47 thoughts on “Finding the Date of the Next Record in Power Query”

  1. Very useful tip! 📅 Finding the date of the next record in Power Query can be tricky, but this guide explains it so well. Great use of indexing and merging to solve a common data challenge. Perfect for anyone working with time series or sequential data in Power BI!

  2. Such a handy trick for time-based data analysis! ⏳ Using Power Query to find the next record’s date can help with calculating durations, lead times, or gaps in data. Sorting and adding an index with a merge step does the magic. Smart and super useful

  3. Great tutorial! Finding the date of the next record in Power Query is super helpful for time-based analysis and comparisons. Clear explanation and very practical!

  4. Лучшее качество при несъемном протезировании на 4 имплантах.
    Протезирование на 4 имплантах [url=https://ggpatl.by/allon4-implantaciya]https://ggpatl.by/allon4-implantaciya[/url] .

  5. Куклы бебета с аксессуарами и одеждой.
    Бебета кукли като истински [url=http://www.kukli-bebeta.com]http://www.kukli-bebeta.com[/url] .

  6. Цены на популярные антистресс игрушки.
    Антистрес играчки за мачкане [url=http://www.antistres-igrachki.com/]http://www.antistres-igrachki.com/[/url] .

Leave a Comment

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