Daily DAX : Day 313 DAY
Power BI DAX DAY Function
Description
The DAY
function in DAX (Data Analysis Expressions) returns the day of the month (an integer from 1 to 31) from a specified date.
Syntax
DAY(<date>)
Parameter:
<date>
: A date in datetime format, or a reference to a column containing dates.
Return Value: An integer between 1 and 31 representing the day of the month.
Use Case
The DAY
function is used to extract the day component from a date for analysis, filtering, or calculations in Power BI reports. Common scenarios include:
- Analyzing trends based on specific days of the month (e.g., sales on the 1st vs. the 15th).
- Creating custom date-based calculations, such as grouping data by day.
- Filtering reports to focus on specific days (e.g., transactions occurring on the last day of the month).
Example
Suppose you have a table named Sales
with a column OrderDate
. To extract the day of the month for each order:
DayOfOrder = DAY(Sales[OrderDate])
If OrderDate
is 2023-10-15
, the function returns 15
.
Notes
- The input date must be in a valid datetime format.
- If the input is blank or invalid, the function may return an error or unexpected results.
- Often used with other DAX date functions like
MONTH
orYEAR
for comprehensive date analysis.
Comments
Post a Comment