Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

subbareddykm
Contributor II

active employee count

Hi All,

I have one requirement, where i have to count Active on year basis.

But in my case , i have created year and month field in data . i ahve used year filter in dimentions and Expressiomn as Count(Emp)

It is giving me only Active employees in that year only but i want as of respective year.

but if create expression for every year wise and filter data field then it giving me correct and also later want create for Year wise month too.

How can i achieve this?

10 Replies
rahulpawarb
Valued Contributor III

Re: active employee count

Hello Subbareddy,

Please refer below given draft expression:

//Considering Year dimension is used in filter

Count({<Year={"<= $(=Max(Year))"}>}Emp)

//Considering Year dimension is used in filter

//If you identify an employee is an active based on flag IsActive (1-Active/0-Inactive)

Count({<Year={"<= $(=Max(Year))"}, IsActive={'1'}>}Emp)

Hope this will be helpful.

Regards!

Rahul

silambarasan
Contributor II

Re: active employee count

How do you identify the active employee?

subbareddykm
Contributor II

Re: active employee count

I have a flag for it

silambarasan
Contributor II

Re: active employee count

count({<Flag={1}>}emp)

1 is active

0 is Inactive

subbareddykm
Contributor II

Re: active employee count

Its not working rahul,

its giving only for that year only.

Let me create sample data for it ,it will be helpful to work on it

rahulpawarb
Valued Contributor III

Re: active employee count

Thank you If possible please share the application with sample data.

subbareddykm
Contributor II

Re: active employee count

Let me explain the scenario,

For example

now we are in 2017 year, If we check active Emp let say 1550.in this if i apply only active Filter then i will get only for 2017 but i want for <=today.

and if we are in 2016 , 2016 max date we have to consider and same like above.

i hope you understand.

ganeshsvm
Contributor

Re: active employee count

Hi,

Providing sample data and your required result in Excel would be easy for us to evaluate the result for you.

-Ganesh

ajsjoshua
Valued Contributor

Re: active employee count

Hi,

Try this

  1. Count({$<Date={"<= $(=Date(Max(Year)))"}, IsActive={'1'}>}Emp) 
  2. Count({<Date={"<= $(=Date(Max(Year)))"}>}Emp)