Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Current year count vs Previous year count

I have these fields in my database, PayRollYear and PayRollMonth and EMPNO.

I want to create a combo chart, that shows the count of employees in the present year vs the previous year. Present year would be a bar chart, and previous year would be a line chart, month being the dimension. Any ideas????

13 Replies
Anonymous
Not applicable
Author

Hello,

- Create a variable something like vMaxYear=max(Year).

- Another variable, PrevYear = vMaxYear-1

- Comcbo chart. 1 Dimension, Month; 2 Expressions:

sum({<Year='$(vMaxYear)'>}Expression1)

sum({<Year='$(vPrevYear)'>}Expression1)

BR

Serhan

Not applicable
Author

you mean, vMaxYear = max(PayRollYear)?

Not applicable
Author

And also, where dao I create these variables?

Anonymous
Not applicable
Author

Yes.

Sorry this is Qlik Sense though. You cannot create variables as in Sense.

Instead ;

sum({<Year={'$(=max(PayRollYear))'}>}Expression1)

sum({<Year={'$(=max(PayRollYear)-1)'}>}Expression1)

BR

Serhan

Not applicable
Author

Thanks a lot!

Not applicable
Author

I am using Qlikview, and if I do as you said, it's giving the same value for both, current and previous.

Anonymous
Not applicable
Author

Here we go.

BR

Serhan

Not applicable
Author

???

Anonymous
Not applicable
Author

Hello,

Open it in QlikView and just copy the formula. That's all.

BR

Serhan