Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
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
sunny_talwar

May be this:

Above Median

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

Below Median

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

Not applicable
Author

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

Try this:

Above Median

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

Below Median

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

kamal_sanguri
Specialist
Specialist

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

sunny_talwar

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
Author

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
Author

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,

sunny_talwar

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

Not applicable
Author

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