# DATE

## What is the DAX Function DATE?

The DAX function DATE allows you to create a date by specifying the year, month, and day. It returns a date value that can then be used in other calculations and functions. The syntax for the DATE function is as follows:

DATE(year, month, day)

``` Where: - **year**: the year as a four-digit number - **month**: the month as a number between 1 and 12 - **day**: the day of the month as a number between 1 and 31 Creating a Date with the DAX Function DATE To create a date with the DAX function DATE, you simply need to provide the year, month, and day as arguments. Here's an example: ```

Date = DATE(2021, 6, 30)

``` This will create a date value of June 30th, 2021. You can then use this date in other calculations and functions. Extracting Components of a Date with the DAX Function DATE The DAX function DATE not only allows you to create dates, but it also allows you to extract specific components of a date. The following are some examples of how you can use the DATE function to extract components of a date: Extracting the Year To extract the year from a date, you can use the YEAR function in conjunction with the DATE function. Here's an example: ```

Year = YEAR(DATE(2021, 6, 30))

``` This will return the year 2021. Extracting the Month To extract the month from a date, you can use the MONTH function in conjunction with the DATE function. Here's an example: ```

Month = MONTH(DATE(2021, 6, 30))

``` This will return the month 6. Extracting the Day To extract the day from a date, you can use the DAY function in conjunction with the DATE function. Here's an example: ```

Day = DAY(DATE(2021, 6, 30))

``` This will return the day 30. Manipulating Dates with the DAX Function DATE The DAX function DATE also allows you to manipulate dates. The following are some examples of how you can use the DATE function to manipulate dates: Adding Days to a Date To add days to a date, you can use the DATE function in conjunction with the '+' operator. Here's an example: ```

New Date = DATE(2021, 6, 30) + 7

``` This will add 7 days to the original date, resulting in a new date of July 7th, 2021. Subtracting Days from a Date To subtract days from a date, you can use the DATE function in conjunction with the '-' operator. Here's an example: ```

New Date = DATE(2021, 6, 30) – 7

``` This will subtract 7 days from the original date, resulting in a new date of June 23rd, 2021. The DAX function DATE can be a very useful tool when working with dates in Power BI. It allows you to create, extract, and manipulate dates with ease. By using the examples provided in this article, you should now have a better understanding of how to use the Power BI DAX function DATE. Power BI DAX Training Courses by G Com Solutions (0800 998 9248) Power BI DAX Intensive Training Course £1,050.00 – £26,550.00 Select optionsContinue Loading Done Power BI DAX Introduction £395.00 – £9,750.00 Select optionsContinue Loading Done Power BI DAX Intermediate £395.00 – £9,750.00 Select optionsContinue Loading Done Power BI DAX Advanced £395.00 – £9,750.00 Select optionsContinue Loading Done Upcoming Courses Contact Us Subject Your Name (required) Company/Organisation Email (required) Telephone Training Course(s) Power BI Intensive TrainingPower BI introduction Power BI IntermediatePower BI AdvancedDAXPower Query MPower BI CertificationPower BI AdministrationPower PlatformPower AutomatePower AppsOTHER Your Message Upload Example Document(s) (Zip multiple files) ```
``` ```
``` ```
``` ```
``` ```
``` ```