Date Functions in
Power BI (DAX)
1.DATE() : Returns the specified date
in datetime format
Syntax = DATE(<year>, <month>,
<day>)
Year Month Day
2021 1 21
2018 3 31
2022 5 2
2021 4 12
2015 3 4
= DATE([Year], [Month], [Day])
2. CALENDAR(): Returns a table with
one column of all dates between
StartDate and EndDate
Syntax = CALENDAR(<StartDate>,
<EndDate>
=CALENDAR (DATE(2022, 1, 1), DATE( 2022, 1, 5))
Date
2022-01-01
2022-01-02
2022-01-03
2022-01-04
2022-01-05
3. DAY(): Returns a number from 1 to 31
representing the day of the month.
Syntax = DAY ( <Date> )
Date
2022-01-01
2022-01-02
2022-01-03
2022-01-04
2022-01-05
=DAY([Date])
4. MONTH(): Returns a number from
1 to 12 representing the month.
Syntax = MONTH ( <Date> )
Date
2022-01-01
2022-01-02
2022-01-03
2022-01-04
2022-01-05
=MONTH([Date])
5. YEAR(): Returns the year of a date
as a four digit integer.
Syntax = YEAR ( <Date> )
Date
2022-01-01
2022-01-02
2022-01-03
2022-01-04
2022-01-05
=YEAR([Date])
6. EMONTH(): Returns the date in
datetime format of the last day of the
month before or after a specified number
of months.
Syntax = EMONTH ( <StartDate>,
<Months> )
Date
2022-01-01
2022-01-02
2022-01-03
2022-01-04
2022-01-05
=EMONTH([Date], -2)
7. DATEDIFF (): Returns the number of
units (unit specified in Interval) between
the input two dates.
Syntax = DATEDIFF ( <Date1>,
<Date2>, <Interval> )
Order Date Ship Date
2022-01-01 2022-01-12
2022-01-02 2022-01-30
2022-01-03 2022-01-13
2022-01-04 2022-01-15
2022-01-05 2022-01-12
= DATEDIFF ([Order Date], [Ship Date], DAY)
8. TODAY (): Returns the current
date in datetime format.
Syntax = TODAY ( )
= TODAY ( )
Date
2023-02-21