Forum Discussion
Time intelligence function returning wrong month
- 2 years ago
Hi again Junkay
The ENDOFMONTH function will produce the expected result as long as the column reference provided as an argument is for a column which contains complete calendar months. If any dates are missing, this function treats the last available date in a given calendar month as the last day of the month. The tutorial you were using may have already had a table containing complete months.
For this reason, I would generally not advise using ENDOFMONTH to return a scalar end-of-month value. EOMONTH is the best function for this.
ENDOFMONTH is typically used within CALCULATE to modify a date filter by shifting it to the last day of the last visible month. ENDOFMONTH returns a 1x1 table which retains lineage to the column reference passed as its argument.
On to your latest question, to return an end-of-quarter date, I would advise using EOMONTH again.
For standard calendar quarters (Jan-Mar, Apr-Jun etc), an expression like this should work:
EOMONTH ( [Date], MOD ( - MONTH ( [Date] ), 3 ) ) - 2 years ago
Hi Owen,
You are a genius. Thank you so much for the support.
I wish I could be this proficient.
Thanks a million times.
Hi again Junkay
The ENDOFMONTH function will produce the expected result as long as the column reference provided as an argument is for a column which contains complete calendar months. If any dates are missing, this function treats the last available date in a given calendar month as the last day of the month. The tutorial you were using may have already had a table containing complete months.
For this reason, I would generally not advise using ENDOFMONTH to return a scalar end-of-month value. EOMONTH is the best function for this.
ENDOFMONTH is typically used within CALCULATE to modify a date filter by shifting it to the last day of the last visible month. ENDOFMONTH returns a 1x1 table which retains lineage to the column reference passed as its argument.
On to your latest question, to return an end-of-quarter date, I would advise using EOMONTH again.
For standard calendar quarters (Jan-Mar, Apr-Jun etc), an expression like this should work:
EOMONTH ( [Date], MOD ( - MONTH ( [Date] ), 3 ) )
Hi Owen,
You are a genius. Thank you so much for the support.
I wish I could be this proficient.
Thanks a million times.