How do I calculate the number of days in a month?
Hi @jcolucci,
To calculate the number of days in a month, you can:
- Truncate the original date to the first day of its month using
truncDate('MM', Date)
. - Add one month to that truncated date using
addDateTime(1, 'MM', truncDate('MM', Date))
. - Calculate the difference in days between these two dates.
That looks like this:
dateDiff(
truncDate('MM', Date),
addDateTime(1, 'MM', truncDate('MM', Date)),
'DD'
)
1 Like
Hi @jcolucci -
You need to use days_in_month
as a GROUP BY
or take the MAX
instead of the default SUM
if you are going to use it as VALUE
Example:
Good morning!
Thanks, Rob! The problem has been solved.
1 Like