Date.ToRecord is a Power Query M function that returns a record containing the parts of the given date value.
Compatible with: Power BI Service Power BI Desktop Excel Microsoft 365
Syntax
Date.ToRecord( date as date ) as record
Description
The Date.ToRecord
function is used to convert a given date into a record containing its individual components: year, month, and day.
Examples
To store the different components of a date value into a record, you can apply the Date.ToRecord
function on a date. This function will split the date into its year, month, and day components and store them in a record format.
Here’s how you can store each component of the #date( 2024, 8, 30 )
value in a record:
// Output: [ Year = 2024, Month = 8, Day = 30 )
Date.ToRecord( #date( 2024, 8, 30 ) )
In this example, the function converts the date August 30, 2024
into a record with the following components:
- Year: 2024
- Month: 8
- Day: 30
This output makes it easy to access and use individual parts of the date separately in subsequent steps of your query.
Related functions
Other functions related to Date.ToRecord are:
2023-2024 © BI Gorilla. All rights are reserved. Information from Microsoft docs is property of Microsoft Corp. | Privacy Policy