Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
RutiTaumanRubin
Creator

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..

Any Advice?

Thank's!

1 Solution

Accepted Solutions
sunny_talwar

May be this

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

View solution in original post

4 Replies
OmarBenSalem

Maybe sthing like this:

count(

{

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

*

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


}


employee)

sunny_talwar

May be this

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

RutiTaumanRubin
Creator
Author

Thank you for your response !

it's not working..

OmarBenSalem

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)


Capture.PNG