Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
hopkinsc
Partner - Specialist III
Partner - Specialist III

Count of Employees by month

Hi All,

I am trying to count employees by month but unsure on how to do this.

My fields are

Employee Id

Start Date

End Date

Month

If an employee starts in Jan and finishes in April, i would want this employee counted from Jan-April but not after

So eg

   

Employee IDEmployee NameStart DateEnd Date
1Person A01/01/2014
2Person B15/01/201521/05/2014
3Person C01/02/2014
4Person D01/06/2014
5Person E01/07/2014
6Person F15/07/2014
7Person G15/07/201401/12/2014
8Person H01/10/201401/12/2014
9Person I01/11/2014
10Person J

15/12/2014

So in these examples, my counts would be..

Jan - 2

Feb - 3

Mar - 3

Apr - 3

May - 3

Jun - 3 (Person B left in May)

Jul - 6

Aug - 6

Sep - 6

Oct - 7

Nov - 8

Dec - 9

Does that make sense?

I have attached an example but unsure if i am going down the right path.

2 Replies
Anonymous
Not applicable

i think this works with 2 small modifications...

1. in your excel table, i think the second row start date is supposed to be 1/15/2014 and that 2015 is just a typo...correct?

2. in your load statement for Employee table, replace [End Date] with the following:

if(len([End Date]) < 2, Date($(vMaxDate)), [End Date]) as [End Date]

the reason i think you were not getting the correct results is because when the end date is null, the calendar field "Date" was not being assigned to the employee.

Optional change: in your Calendar table load statement, replace Month(Date) as Month to MonthName(Date) as Month

Now...the table you need is a straight table with Month as dimension and count(distinct [Employee ID] as expression. suppress values when null in dimensions tab checked.

see attached!

fred_s
Partner - Creator III
Partner - Creator III

Hi Hopkinsc,

See attachment.

Person B is out because your startdate is 2015.

Grtz Fred