Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Not applicable

Trying to write expressions but getting error

I am trying to count the employee, who are above or below the median salary.

The expressions I am using is as follows:

Count({<[CTC]={">="} Median({<[CTC]>} [Employee])

Please help.

24 Replies
MVP
MVP

Re: Trying to write expressions but getting error

May be this:

Above Median

Count({<Employee = {"=CTC > Median(TOTAL CTC)"} Employee)

Below Median

Count({<Employee = {"=CTC < Median(TOTAL CTC)"} Employee)

Not applicable

Re: Trying to write expressions but getting error

Thanks for quick response.

I am still not able to get the count. Let me give you more clarity / understanding of data.

I have a column name "Employee Name" & "CTC (USD)". Now trying to write expression on Qlik Sense to get count of employee who are above or below median CTC.

Have tried this: Count({<[Employee Name] = {"=CTC > Median[CTC (USD)])"} [Employee Name])

but didn't work.

Please help.


kamal_sanguri
Valued Contributor

Re: Trying to write expressions but getting error

Try this:

Above Median

=count(if(CTC>Median(Total CTC),Employee ))

Below Median

=count(if(CTC<Median(Total CTC),Employee ))

kamal_sanguri
Valued Contributor

Re: Trying to write expressions but getting error

you sure.. you tried this, I mean it is working for me..

Above Median

=count(if(CTC>Median(Total CTC),Employee ))

Below Median

=count(if(CTC<Median(Total CTC),Employee ))

MVP
MVP

Re: Trying to write expressions but getting error

I guess if the name of the column is CTC (USD), then try this:

Count({<[Employee Name] = {"=[CTC (USD)] > Median(TOTAL [CTC (USD)])"} [Employee Name])

Not applicable

Re: Trying to write expressions but getting error

Thanks Kamal !!! The given formula is working absolutely fine however still not solving the purpose.

Its giving the count of employee, who are above or below the median but calculating the median of entire population. For example: Data has all job levels like: Executive, Senior Executive till higher leadership. If we compare the CTC with higher leadership with junior management then this will not the right way of analysis.

Can it be possible that the median / average automatically changed when we draw a graph at Job level?? I believe this is due to  "Median(Total CTC)".

I tried "count(if([CTC (USD)] > Median([CTC (USD)])]),[Employee Name]))" but expression error. Please help

Not applicable

Re: Trying to write expressions but getting error

Thanks Sunny for your response but this is still not working. Writing Median command under " " will not get identified by the application.

Also, can we avoid the "Total" Command as this will be resulting wrong analysis. Please suggest,

MVP
MVP

Re: Trying to write expressions but getting error

Would you be able to share a sample to show where this isn't working?

Not applicable

Re: Trying to write expressions but getting error

I have shared the dummy data on another post as unable to attached the same in this post.


Community Browser