OpenBI Docs Buy

List.Dates

A list of dates from a start, a set count of them, each a step from the last.

Group: List. Power Query M has it too: a query that uses it is written as in Power BI.

Syntax

List.Dates(start as date, count as number, step as duration) as list
ParameterTypeDescription
startdateThe first date.
countnumberHow many dates.
stepdurationThe step between dates, such as #duration(1, 0, 0, 0) for each day or #duration(7, 0, 0, 0) for each week.

Returns

list. The dates.

Remarks

  • Months and years have no fixed length, so a monthly list is made otherwise: List.Transform({0..11}, each Date.AddMonths(start, _)).

Examples

Five days across a month end

List.Dates(#date(2024, 1, 29), 5, #duration(1, 0, 0, 0))
{#date(2024, 1, 29), #date(2024, 1, 30), #date(2024, 1, 31), #date(2024, 2, 1), #date(2024, 2, 2)}

The list runs on from January into February by itself.

Mondays for a weekly report

List.Dates(#date(2024, 1, 1), 4, #duration(7, 0, 0, 0))
{#date(2024, 1, 1), #date(2024, 1, 8), #date(2024, 1, 15), #date(2024, 1, 22)}

List.DateTimes, Date.AddDays, Date.AddMonths.

Last updated · OpenBI Studio 0.3.79