2 Replies Latest reply: Jul 31, 2018 8:05 AM by Manoj Kumar M R

Percentage calculation with filter condition

Hi All,

I need to calculate percentage of number employees in HR department (wrt to all employees) and % of sum of salary in HR dept (wrt to all employees). So I'm writing an expression like below, but it is not giving correct result.

(count({<Dept={'HR'}>}Id)/count({<Dept={'HR'}>}Total(Id)))*100

(Sum({<Dept={'HR'}>}[salary])/Sum({<Dept={'HR'}>}Total([salary])))*100

• Re: Percentage calculation with filter condition

(count({<Dept={'HR'}>}Id)/count({<Dept={'HR'}>}Total(Id)))*100

(Sum({<Dept={'HR'}>}[salary])/Sum({<Dept={'HR'}>}Total([salary])))*100

You are using Dept=HR filter in both the expressions...

I think you said you want it by all the employees, not just the HR Dept. Maybe you do not need Total here

Just a basic expression might work?

(count({<Dept={'HR'}>}Id)/count(Id))*100

(Sum({<Dept={'HR'}>}[salary])/Sum ([salary]))*100

Not sure if above expression I gave is correct or not..

• Re: Percentage calculation with filter condition

Thanks Shahbaz, second one worked for me..

(count({<Dept={'HR'}>}Id)/count(Id))*100

(Sum({<Dept={'HR'}>}[salary])/Sum ([salary]))*100