3 Replies Latest reply on Jan 4, 2016 1:19 PM by Ryan Rogers

# Case Month(date) to set # of working days in a month not working.

I am trying to create a calculation that sets the number of days in a month to = a certain number i.e., the number of specific working days in that month. Basically, if the month is January then the # of days needs to = 19, February then 20 days, March then 22 days, etc.

I have created a calculation (see screenshot below) that shows I am using the case month(date) to set the number of days for each month. The problem is I am getting get numbers of days in that month that each employee worked instead of the number I set.

Based on my calculation every number in January should appear to be 19, but I am getting 15 for the first example, 21 for the second, and then two blanks. Any thoughts? Thank you!

• ###### 1. Re: Case Month(date) to set # of working days in a month not working.

Can you post up a sample TWBX using Superstore Sales or another sample data set? It'll be much easier to jump in and take a look based on what you've done thus far.  Cheers!

• ###### 2. Re: Case Month(date) to set # of working days in a month not working.

Matt,

I don't know what your end goal is with the type of a calculation you are doing, but if you aggregate your date field under the ATTR() you get the required output:

See the CASE statement below:

1 of 1 people found this helpful
• ###### 3. Re: Case Month(date) to set # of working days in a month not working.

Yeah, the prior calculation using COUNT was just returning the number of records for that month.  The number in the calculation (19, 21, etc), didn't matter.  You could assign a value of 1 to each WHEN statement, and you'd get the same results as in the original because, again, it's counting the number of times that the assigned value appears for the named month.