Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
(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..
(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..
Thanks Shahbaz, second one worked for me..
(count({<Dept={'HR'}>}Id)/count(Id))*100
(Sum({<Dept={'HR'}>}[salary])/Sum ([salary]))*100
Dear Manoj,
Just wanted to check, id is a column which is primary key for Emp table, right?
In summary, Table structure for this is Id and Deparment, am i right in my understanding?