Date.Day
DateReturns the day of the month from a date value.
Syntax
Date.Day(dateTime as any) as nullable numberParameters
| Name | Type | Required | Description |
|---|---|---|---|
dateTime | any | Yes | The date value to extract the day from. |
Return Value
number — The day component of the date (1 through 31).
Remarks
Date.Day returns the day-of-month component as a number from 1 to 31 from a date, datetime, or datetimezone value. If the input is null, the function returns null.
Examples
Example 1: Extract the day from OrderDate
Table.AddColumn(
Table.SelectColumns(
Table.FirstN(Sales, 5),
{"OrderID", "OrderDate"}
),
"Day", each Date.Day([OrderDate]), Int64.Type
)Result
OrderID | OrderDate | Day | |
|---|---|---|---|
| 1 | 1 | 1/15/2024 | 15 |
| 2 | 2 | 1/18/2024 | 18 |
| 3 | 3 | 2/1/2024 | 1 |
| 4 | 4 | 2/10/2024 | 10 |
| 5 | 5 | 3/5/2024 | 5 |
Example 2: Extract the day from a scalar value
#table(
type table [Date = date, Day = number],
{{#date(2024, 4, 15), Date.Day(#date(2024, 4, 15))}}
)Result
Date | Day | |
|---|---|---|
| 1 | 4/15/2024 | 15 |
Compatibility
✓ Power BI Desktop✓ Power BI Service✓ Excel Desktop✓ Excel Online✓ Dataflows✓ Fabric Notebooks