RANKX assigns a rank to each item of a table according to an expression, while TOPN returns the top N rows of a table according to a sort criterion. Both depend on the filter context: the ranking is done on the visible items, which affects the choice of ALL.
Example
Rang = RANKX(ALL(Produits[Nom]), [CA])