OpenBI Docs Buy

Date.DaysInMonth

How many days the month of a date has: 28 to 31.

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

Syntax

Date.DaysInMonth(dateTime as any) as nullable number
ParameterTypeDescription
dateTimeanyA date, datetime or datetimezone value; null gives null.

Returns

nullable number. The length of the month.

Remarks

  • Handy for spreading a monthly budget over its days.

Examples

February in a leap year

Date.DaysInMonth(#date(2024, 2, 10))
29

A month's budget per day

12400 / Date.DaysInMonth(#date(2024, 3, 1))
400

12 400 spread over the 31 days of March.

Date.EndOfMonth, Date.IsLeapYear, Date.Day.

Last updated · OpenBI Studio 0.3.79