Date Functions
Posted: Sat 04 Apr 2015 15:45
Does anyone know if it is possible to use any of the CALENDAR_ functions available in the SOQL spec? I need to do the following
SELECT CALENDAR_YEAR(CloseDate), SUM(Amount)
FROM Opportunity
GROUP BY CALENDAR_YEAR(CloseDate)
To basically get a sum of all the amounts per year. Searched through the forum but cannot find any reference to these functions. They seem pretty useful to me and I would be surprised nobody else would need to do something similar. Below are the functions supported by SF on date
CALENDAR_MONTH()
CALENDAR_QUARTER()
CALENDAR_YEAR()
DAY_IN_MONTH()
DAY_IN_WEEK()
DAY_IN_YEAR()
DAY_ONLY()
FISCAL_MONTH()
FISCAL_QUARTER()
FISCAL_YEAR()
HOUR_IN_DAY()
WEEK_IN_MONTH()
WEEK_IN_YEAR()
SELECT CALENDAR_YEAR(CloseDate), SUM(Amount)
FROM Opportunity
GROUP BY CALENDAR_YEAR(CloseDate)
To basically get a sum of all the amounts per year. Searched through the forum but cannot find any reference to these functions. They seem pretty useful to me and I would be surprised nobody else would need to do something similar. Below are the functions supported by SF on date
CALENDAR_MONTH()
CALENDAR_QUARTER()
CALENDAR_YEAR()
DAY_IN_MONTH()
DAY_IN_WEEK()
DAY_IN_YEAR()
DAY_ONLY()
FISCAL_MONTH()
FISCAL_QUARTER()
FISCAL_YEAR()
HOUR_IN_DAY()
WEEK_IN_MONTH()
WEEK_IN_YEAR()