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

Opening Head Count - Employees - URGENT Help required

Dear All,

I have empno , empname, doj,date_of_resign  fields

how i can show opening headcount/gross additions/attrition/closing head count

GRADEOpening HeadcountGross AdditionsAttritionNet AdditionsClosing Headcount
ASSOCIATE193303196
STAFF7430377
SUPERVISOR8000080
TRAINEE3211032
WORKERS9500095
Total474716480

Please any one have idea please give guide lines also I want to calculate Attriation rate company level how I do this ?

Thanks in avanace

Vikas

Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution & like it.
If you want to go quickly, go alone. If you want to go far, go together.
1 Solution

Accepted Solutions
salto
Specialist II
Specialist II

Hello,

this may help you - please check and let me know.

Regards.

View solution in original post

26 Replies
vikasmahajan
Author

Does any body design this type of requirement

Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution & like it.
If you want to go quickly, go alone. If you want to go far, go together.
jonathandienst
Partner - Champion III
Partner - Champion III

Hi

Something like this

// set start date of headcount table

Let vStartDate = Date#('2013/01/01'); 

// set monthly range for headcount table

T_Data:                                                

LOAD PeriodID,

  Date(AddMonths($(vStartDate), PeriodID - 1), 'YYYY-MM') As MonthYr

;

LOAD RecNo() As PeriodID

AutoNumber 24;

//Load employee data

Employees:

LOAD grade,

  empno,

  empname,

  MonthStart(doj) As StartDate,

  MonthStart(date_of_resign) As EndDate

From .....

// Join the tables

Join (T_Data)

LOAD * Resident Employees;

// Identify active employees

T_Data2:

LOAD grade,

  PeriodID,

  MonthYr,

  empno,

  If(StartDate < MonthYr And MonthYr <= EndDate, 1, 0) As Active

Resident T_Data;

//Construct headcount table

HeadCount:

LOAD *,

  GrossAdditions - Attrition As NetAdditions,

  OpeningBalance + GrossAdditions - Attrition As ClosingBalance

;

LOAD PeriodID,

  MonthYr,

  grade,

  Count(Distinct If(Active = 1, empno)) As OpeningBalance,

  Count(Distinct If(MonthStart(StartDate) = MonthYr) empno) As GrossAdditions,

  Count(Distinct If(Active = 1 And EndDate = MonthYr, empno)) As Attrition

Resident T_Data2\

Group By PeriodID, MonthYr, grade

;

//Cleanup

DROP Table T_Data, T_Data2;

(check for syntax errors like missing commas etc)

HTH

Jonathan

Edit - added missing Group By...

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
vikasmahajan
Author

Do you have full scirpt please send me

Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution & like it.
If you want to go quickly, go alone. If you want to go far, go together.
vikasmahajan
Author

Please can you give me full script I am not able to get it.

Vikas

Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution & like it.
If you want to go quickly, go alone. If you want to go far, go together.
salto
Specialist II
Specialist II

Hello,

this may help you - please check and let me know.

Regards.

vikasmahajan
Author

Thanks Mr.SALTO I will check N Get Back you soon.

Vikas

Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution & like it.
If you want to go quickly, go alone. If you want to go far, go together.
vikasmahajan
Author

Dear  Mr.Jose,

Find attachment of my live data with qvw  I have try your solution can you please help me to

how to implement in Live data.

Thanks

Vikas

Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution & like it.
If you want to go quickly, go alone. If you want to go far, go together.
salto
Specialist II
Specialist II

Hi Vikas,

the "grade" filed is not available, I have made the chart with S_Active as the dimension. Hope this helps!

vikasmahajan
Author

Thanks

I will check and get back you

Vikas

Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution & like it.
If you want to go quickly, go alone. If you want to go far, go together.