Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Qlik__Vinodh
Partner - Creator II
Partner - Creator II

Max count comparison on year /previous year

Dear all,

I am having one problem,that is

1. I am having 5 years data now,if i click a year in dashboard, i need current year max employee count Month data and previous year max employee count month data in bar chart .

2. dimension is month, and Expression is  Count(distint Emp_Id).

3. any one having sample application for same soluation ,share me.

if any one knows the soluation.pls help me.

Thanks,

c vr

13 Replies
Not applicable

Hi,

You can use a bar chart with Year as dimension and expressions as:

1. =count({<Year={$(vLastYear)}>}distinct Employee)

where vLastYear is a variable defined as:

=Year(Today())-1

2. =count({<Year={$(vCurrentYear)}>}distinct Employee)

where vCurrentYear is a variable defined as:

=Year(Today())

Please find the sample attached.

Is that what you are looking for?

Regards,

-Khaled.

Qlik__Vinodh
Partner - Creator II
Partner - Creator II
Author

This is ok,but i need the max of employee count in current year and previous year. it mean which month having the top employees count in current year and previous year.  this comparison is required.help me

Not applicable

Hi,

Just noticed that you need the value for year selected by user and its previous year.

Here's the updated QVW.

For this implementation:

1. Define a variable named vSelectedYear

with definition     =GetFieldSelections(Year)

2. Define another variable named vPreviousYear

with definition     =GetFieldSelections(Year)

and add these expressions in the bar  chart:

1. =sum({<Year={$(vSelectedYear)}>}Value)

2. =sum({<Year={$(vPreviousYear)}>}Value)

Please find the QVW attached.

Hope that helps.

Regards,

-Khaled.

Qlik__Vinodh
Partner - Creator II
Partner - Creator II
Author

ok,but i need Max of count in current yearmonth and max of count in previous yearmonth

Qlik__Vinodh
Partner - Creator II
Partner - Creator II
Author

ok,but i need Max of count in current yearmonth and max of count in previous yearmonth

it means which month having the highest count in current year and previous year is required.help me

jagan
Partner - Champion III
Partner - Champion III

HI,

Can you attach the sample file.

Regards,

Jagan.

Qlik__Vinodh
Partner - Creator II
Partner - Creator II
Author

hi,

i need one sample application for what i am asking u friend.

Qlik__Vinodh
Partner - Creator II
Partner - Creator II
Author

Hi all,

i need the current year month and previous year month comparison ,but this months should be highest values in that years, when user selecting one year.

Not applicable

Hi,

Try this:

=sum({<Month={$(=Max(Month))},Year={$(vSelectedYear)}>} Value )        --- for the Current Selected Year

=sum( {$<Month = {$(=Max(Month)-1)},Year={$(vPreviousYear)}>} Value )   -- for the previous year

This should always use the max month to calculate the value.

Hope that helps.

Regards,

-Khaled.