DAX Date & Time - EOMONTH function


Advertisements

Description

Returns the date in datetime format of the last day of the month, before or after a specified number of months.

Syntax

EOMONTH (<start_date>, <months>) 

Parameters

Sr.No. Parameter & Description
1

start_date

A date that represents the start date.

It can be in datetime or text format.

2

months

A whole number that represents the number of months before or after start_date.

If months is not an integer, rounded up or down to the nearest integer.

Return Value

A date in datetime format.

Remarks

You can use EOMONTH to calculate the maturity dates or due dates that fall on the last day of the month.

DAX works with dates in datetime format. Dates stored in other formats are converted implicitly.

  • If start_date is not a valid date, EOMONTH returns an error.

  • If start_date plus months yields an invalid date, EOMONTH returns an error. Dates before March 1st of 1900 and after December 31st of 9999 are invalid.

  • DAX EOMONTH function uses the locale and date/time settings of the client computer to understand the text value in order to perform the conversion. For example,

    • If the current date/time settings represent dates in the format of Month/Day/Year, then the string, "1/8/2016" is understood as a datetime value equivalent to 8th January, 2016.

    • If the current date/time settings represent dates in the format of Day/Month/Year, the same string would be understood as a datetime value equivalent to 1st August, 2016.

If the text representation of the date cannot be correctly converted to a datetime value, the function returns an error.

Example

= EOMONTH (DATE (2016,4,5),5) returns 9/30/2016 12:00:00 AM 
= EOMONTH (DATE (2016,4,5),4.5) also returns 9/30/2016 12:00:00 AM, as 4.5 will be rounded up to 5. 
dax_functions_date_time.htm

Useful Video Courses


Video

Mastering DAX and Data Models in Power BI Desktop

53 Lectures 5.5 hours

Abhay Gadiya

Video

Mastering DAX Studio

Featured

24 Lectures 2 hours

Randy Minder

Video

DAX / Power BI - Customer and Sales Analysis Deep Dive

26 Lectures 4.5 hours

Randy Minder

Advertisements