4 Replies Latest reply: Aug 23, 2018 8:30 AM by omar bensalem

# Count compared to previous year- QlikSense

Hi everyone,

I want to create measure with the following calculate:

count of EMPLOYEES where field STATUS='ACTIVE' for this year and was 'NOT ACTIVE' for last year..

Thank's!

• ###### Re: Count compared to previous year- QlikSense

Maybe sthing like this:

count(

{

<STATUS={'ACTIVE'},Year={"\$(=max(Year))"}>

*

<STATUS={'NOT ACTIVE'},Year={"\$(=max(Year)-1)"}>

}

employee)

• ###### Re: Count compared to previous year- QlikSense

Thank you for your response !

it's not working..

• ###### Re: Count compared to previous year- QlikSense

Suppose u have this:

EmployeeYearStatus
12018ACTIVE
12017NOT ACTIVE
22018ACTIVE

The result should be : 1 employee which is employee 1 because he was active in 2018 and inactive in 2017 or both employees because one of the conditions is met?

Because this works:

Count(distinct {<Employee = p({<Year = {"\$(=Max(Year))"}, Status = {'ACTIVE'}>})*p({<Year = {"\$(=Max(Year)-1)"}, Status = {'NOT ACTIVE'}>})>}Employee)

• ###### Re: Count compared to previous year- QlikSense

May be this

Count({<Emp = p({<Year = {"\$(=Max(Year))"}, STATUS = {'ACTIVE'}>})*p({<Year = {"\$(=Max(Year)-1)"}, STATUS = {'NOT ACTIVE'}>})>}Emp)