DAX Date and Time Functions
Date and Time Functions within Microsoft Power BI.
A. YEAR:
OrderYear = YEAR(Sales[OrderDate])
This example extracts the year from the OrderDate column in the Sales table, providing the year value for each order.
B. MONTH:
OrderMonth = MONTH(Sales[OrderDate])
This example extracts the month from the OrderDate column in the Sales table, providing the month value for each order.
C. DAY:
OrderDay = DAY(Sales[OrderDate])
This example extracts the day from the OrderDate column in the Sales table, providing the day value for each order.
D. DATE:
DateValue = DATE(2023, 6, 30)
This example creates a date using the specified year (2023), month (6), and day (30) values, resulting in the date "June 30, 2023".
E. TODAY:
CurrentDate = TODAY()
This example returns the current date as of when the calculation is performed. It provides the current date dynamically.
423