Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

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
darkhorse
Valued Contributor

Re: Current year count vs Previous year count

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

Re: Current year count vs Previous year count

you mean, vMaxYear = max(PayRollYear)?

Not applicable

Re: Current year count vs Previous year count

And also, where dao I create these variables?

darkhorse
Valued Contributor

Re: Current year count vs Previous year count

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

Re: Current year count vs Previous year count

Thanks a lot!

Not applicable

Re: Current year count vs Previous year count

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

darkhorse
Valued Contributor

Re: Current year count vs Previous year count

Here we go.

BR

Serhan

Not applicable

Re: Current year count vs Previous year count

???

darkhorse
Valued Contributor

Re: Current year count vs Previous year count

Hello,

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

BR

Serhan