Page 1 of 1

Create list of date ranges from a list of dates.

Posted: Thu Nov 07, 2019 5:57 am
by drigloff
Please help me create a function in Power Query.
At one of the steps of the query, as a result, I get a list of dates. Some go sequentially, some separately. The quantity is not fixed.
Example (MM.DD.YYYY):
{01/01/2019, 01/02/2019, 01/03/2019, 01/05/2019, 01/06/2019, 01/08/2019}
I need to determine all intervals of consecutive dates and reflect the list of such intervals. The interval is set by the start and end dates. If there is one continuous date, then it is the beginning and the end.
An example from the previous data:
{{01/01/2019, 01/03/2019}, {01/05/2019, 01/06/2019}, {01/08/2019, 01/08/2019}}.
Please help me write a function to solve this problem.
In my data there are about 10,000 lines, each of which has a list attached up to 365 days. It is desirable that the function works quickly.
It feels like list.generate can help, but I don't understand this function very well.