Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello ,
I want to use rank func and need to found the first 10 best sal usig rank func
and emp table has emp_id , sal .
can any one help me ???
Try creating a straight table with dimension emp_id and as expression:
sum({<emp_id ={"=rank(sum(sal))<=10"}>} sal)
This should filter your Top 10 Employees by Sales amount. (Another approach would be to just use sum(sal) as expression, sort your table by the expression, numerical desc and then limit your table to first 10 lines in dimension limits tab. But since you asked for rank function...)
Hope this helps,
Stefan
The major difference between limiting table to the first 10 lines and using rank is that in the first case the total line (if you're using it) does not exclude results for the ranks>10. So, using rank makes sense.
Next, I prefer to use it in dimension, replacing emp_id with calcualted dimension:
=aggr(only({<emp_id={"=rank(sum(sal))<=10"}>} emp_id),emp_id)
(make sure to check "suppress if value is null")
It helps in case you have multiple expressions, and want to rank by one of them.
Regards,
Michael