RANKX Vs TOPN what is the difference?


Hi Sam trying to get my head around this.
Even after doing many YouTube Videos around TOPN and RANKX I still cannot get my head around this function.

RANKX - I get this, RANKX (row level data it’s being RANKED, similar to Excel RANK. This is below what I have.


TOPN (this is really confusing)
As you will see my TOPN is different to my RANKX number.
From a business perspective more so, how and why would i need to use TOPN compared to RANKX?
Is there any advice you could please give me with best understanding TOPN and in what situation to use TOPN please.




Just remember with TOPN you are currently ranking by Product[Product Name]

You may be confused due to an error I had in the youtube clip, but I mention in the comments you may will want to change that part to a measure.

The big difference between this two is the TOPN is a table function while RANKX returns a scalar value.

It’s all about understanding the context you place these functions into.

Just try changing up the TOPN function as I’ve described and see if that changes things first.