List.Dates is a Power Query M function that generates a list of date values with a specified size, starting point, and step increment. The function returns a list of date values incremented by the given duration value.
Compatible with: Power BI Service Power BI Desktop Excel Microsoft 365
Syntax
List.Dates(
start as date,
count as number,
step as duration,
) as list
Description
Returns a list of date
values of size count
, starting at start
. The given increment, step
, is a duration
value that is added to every value.
Examples
Create a list of 5 values starting from New Year’s Eve ( #date( 2011, 12, 31 ) ) incrementing by 1 day( #duration( 1, 0, 0, 0 ) ).
List.Dates( #date( 2011, 12, 31 ), 5, #duration( 1, 0, 0, 0 ) )
/* Output:
{
#date( 2011, 12, 31 ),
#date( 2012, 1, 1 ),
#date( 2012, 1, 2 ),
#date( 2012, 1, 3 ),
#date( 2012, 1, 4 )
}
*/
Related articles
Learn more about List.Dates in the following articles:
- Creating Sequences in Power Query
Create Sequences in Power Query and Simplify your Code. Learn how to generate series of numbers, text, symbols, and dates with simple functions. » Read more - Create Date Table or Calendar in Power Query M
Learn how to create a dynamic calendar table in Power Query’s M language. Build your custom columns and claim your free Date Table Script. » Read more - Lists in Power Query M / List Functions (200+ Examples)
The complete guide to Lists in Power Query M. Learn from practical examples and master Power Query’s most powerful List functions. » Read more
Related functions
Other functions related to List.Dates are: