4 Replies Latest reply on May 22, 2012 6:23 AM by Carol Gensimore

# # of Days in a month

Does anyone have a formula for dynamically calculating the number days in the month?

Thank you.

• ###### 1. Re: # of Days in a month

Hi Carol,

One way this can be done is creating a calculated field similar to the following:

if (datename('month',[Order Date]))=(datename('month',[Order Date])) then (datename('day', [Order Date])) end

Then, creating a second calculation:

countd([above calculation])

Then, place the year on the filter shelf and filter accordingly.

Hope this helps!

-Tracy

2 of 2 people found this helpful
• ###### 2. Re: # of Days in a month

Given any input date like 4/5/12 and you wanted to know the number of days in April (assuming US style dates)

Seems to work including leap years and the like

EDIT: Reading Tracy's answer, now I'm not sure what you actually want

• ###### 3. Re: # of Days in a month

Tracy -

Carol

• ###### 4. Re: # of Days in a month

Alex -

Worked like a dream thank you.

Carol