I have a table so called EMPLOYEE and 1 column on this table is so called SALARY.
Example Data:
Salary
1000
2000
3000
4000
5000
How can I formulate to get the value 3000?
Solved! Go to Solution.
Thank you.
However I believe a, better expression will be as below. Minor changes highlighted in red. Please test well.
IF(MOD(COUNT(EMPLOYEE[Salary]),2)=0,
AVERAGE(LIST(INDEX(SORT(EMPLOYEE[Salary], FALSE), COUNT(EMPLOYEE[Salary])/2+1),
INDEX(SORT(EMPLOYEE[Salary], FALSE), COUNT(EMPLOYEE[Salary])/2))),
INDEX(SORT(EMPLOYEE[Salary], FALSE), (COUNT(EMPLOYEE[Salary])-1)/2+1)
)
average is difference from median right?
example: {1,1,2,4,5}
the median here is 2
the average here is 2.6
Oh yes, got it. Please try
IF(MOD(COUNT(EMPLOYEE[Salary]),2)=0,
AVERAGE(LIST(INDEX(SORT(EMPLOYEE[Salary], FALSE), COUNT(EMPLOYEE[Salary])/2+1),
INDEX(SORT(EMPLOYEE[Salary], FALSE), COUNT(EMPLOYEE[Salary])/2))),
INDEX(SORT(EMPLOYEE[Salary], FALSE), COUNT(EMPLOYEE[Salary])/2+1)
)
Not thoroughly tested. Please test it well.
It worked! Thanks alot
Thank you.
However I believe a, better expression will be as below. Minor changes highlighted in red. Please test well.
IF(MOD(COUNT(EMPLOYEE[Salary]),2)=0,
AVERAGE(LIST(INDEX(SORT(EMPLOYEE[Salary], FALSE), COUNT(EMPLOYEE[Salary])/2+1),
INDEX(SORT(EMPLOYEE[Salary], FALSE), COUNT(EMPLOYEE[Salary])/2))),
INDEX(SORT(EMPLOYEE[Salary], FALSE), (COUNT(EMPLOYEE[Salary])-1)/2+1)
)
User | Count |
---|---|
17 | |
11 | |
7 | |
5 | |
5 |