Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
retko1985
Creator II
Creator II

Rank with/without Arrg - giving different result in a textbox/straight table.

Hello,

I am having the problem with ranking.

I am try to display ranks on two places, in a straight table and in text box - but I receive different numbers of ranks here:

Here is the expression I am using for a chart:

rank(

    (Sum({<SiteDealerNo={'*'}, ContractDealerNo=>}[request Quantity])

    -Sum({<Year={$(=max(Year)-1)}, SiteDealerNo={'*'}, ContractDealerNo=>}[request Quantity]))

,0,1)

The dimension is ContractDealerNo

And this is the expression I am using for the text box, with the aggr:

=

aggr(

    rank(

        Sum({$<SiteDealerNo={'*'}, ContractDealerNo=>}[request Quantity])

        -Sum({$<Year={$(=max(Year)-1)}, SiteDealerNo={'*'}, ContractDealerNo=>}[request Quantity])

    ,1,0)

, ContractDealerNo)

---

Now I tried to put both of them in a straight table - and I get different result for the contract:

Just One my discovery is, that I I don't use the subtraction of the last Year and Rank just this Year, it seems correct.

Does someone has any Ideas why is this different and how might I fix this?

Thank you.

4 Replies
sunny_talwar

The two expressions are slightly different (except for Aggr())

Capture.PNG

retko1985
Creator II
Creator II
Author

Nope, still the same.. I actual had it the same from start in the table.. I tried different rank parameters, all still gives same result.

sunny_talwar

Would you be able to add a sample to check this out?

retko1985
Creator II
Creator II
Author

Well, I found the culprit, which was the rounding. The round function with num helped. (So maybe for next generations).