List.DateTimes

This function generates a series of datetime values based on the specified parameters. The series will begin at the provided starting point, with a total of count values included. The increment, repre...

Syntax

List.DateTimes(start as datetime, count as number, step as duration) as list

About

This function generates a series of datetime values based on the specified parameters. The series will begin at the provided starting point, with a total of count values included. The increment, represented by the step parameter, is a duration value that will be added to each datetime value in the series.

Explanation

Generate a list of 10 values starting 5 minutes before New Year's Day 2011 and increasing by 1 minute each time. This can be done using Power Query with the following code: "MList.DateTimes(#datetime(2011, 12, 31, 23, 55, 0), 10, #duration(0, 0, 1, 0))". The output will be as follows: { #datetime(2011, 12, 31, 23, 55, 0), #datetime(2011, 12, 31, 23, 56, 0), #datetime(2011, 12, 31, 23, 57, 0), #datetime(2011, 12, 31, 23, 58, 0), #datetime(2011, 12, 31, 23, 59, 0), #datetime(2012, 1, 1, 0, 0, 0), #datetime(2012, 1, 1, 0, 1, 0), #datetime(2012, 1, 1, 0, 2, 0), #datetime(2012, 1, 1, 0, 3, 0), #datetime(2012, 1, 1, 0, 4, 0) }