How ranking works

Hello guys,
I don’t know if this is the right place for this question, but i hope it is.
I wanna learn the ranking function. The purpose is to know, from the products dimension table and for the clients dimension table, their ranking from 1 to 100. Later i will choose the top 20 or 50 or whatever. Both tables are connected to Sales table, and this one to Dates.
I know that Sam has some great videos but i would like to start from the beginning.
Can you advise me the videos to start and so on?
Thanks a lot guys
Pedro

Hi @pedroccamara,

I always find the knowledge base a good place to start, it explains the functions but also includes links to related content in the portal, forum and blog.

https://info.enterprisedna.co/dax-function-guide/rankx/

.

You might also want to explore

https://info.enterprisedna.co/dax-function-guide/topn/
.
But you can also use the Search option on the forum, choose “Options”, click “Enterprise DNA Online” on the right hand side and extend the search term in the search box.

I hope this is helpful.

2 Likes

I’m sure it will be helpful, and i totally agree with you. I’m tired of asking how to, instead of learning from the beginning, and from a GOOD BEGINNING. Sometimes we don’t have time for more but when you realize it’s bad for you, that you’re gonna always be dependent on someone, that’s when you know you have to change that “learning method”.
Thank you so much for helping me out again @Melissa.
Best regards
Pedro

Hi @pedroccamara,

There’s nothing wrong with asking for help, we all need that at times.

I think it’s more important what you do with ‘the solution’ and with the knowledge you’ve gathered along the way because I’m convinced we all have something to share with this community.

@Brian did a great video you will want to check out…

2 Likes

@pedroccamara,

I 100% agree with @Melissa‘s advice above, but have one additional thing to add, particularly for ranking which is superficially simple, but can be fiendishly difficult to get right/debug in complex contexts. In really understanding any function fully, it’s necessary to understand how DAX processes it.

Thus, after working through the videos and resources Melissa recommended, I would carefully study the full ranking section in the Definitive Guide to DAX. Some might say to do that first, but for me developing the applied knowledge first gives me a better foundation to understand the more theoretical. You’ll have to experiment with which works better for you - the key is that both are necessary.

  • Brian
3 Likes

Hey @BrianJ
I haven´t found the Definitive Guide to Dax, but the Mastering Dax Calculations has a 3 video topic on rankings. Gonna watch them also now. Please let me know if there is a Definitive Guide to DAX video because i didn’t find it.
Thank you so much @BrianJ for “stepping in”.

@pedroccamara,

Sorry – I should’ve clarified that. The Definitive Guide to DAX is a book written by Marco Russo and Alberto Ferrari. If anything, that title is an understatement as it is truly the “bible” of DAX, at 730+ pages. For anyone doing any serious work in Power BI it is an absolute “must have”.

  • Brian

It’s perfect @BrianJ. Don’t worry. As i said, i’ve looked at those 3 videos from Sam and they’re very good. May i take this chance just to ask you something that crossed my mind? This measure:
RANKX(
CROSSJOIN( ALL( ‘Tab Clients’[Client] ), ALL( ‘Tab Products & Category’[Product] ) ),
[Total Sales], DESC )
it shows us the ranking of clients by products, My question is, what if i would like to know the ranking of products by clients? Would i just reverse the order of croosjoin, like,
CROSSJOIN( ALL( ‘Tab Products & Category’[Product] ), ALL( ‘Tab Clients’[Client] ),
Would you agree with me?

@pedroccamara,

No, would disagree with that statement. Crossjoin just takes two columns and creates every possible combination of elements from each - the order of tables in crossjoin doesn’t matter. For example in the last Data Challenge, there were 10 warehouses and 50 cities. Crossjoin in either order produced the same 500 unique combination pairs of warehouse and city. What your ultimate ranking will show depends on the other elements in your measure and the evaluation context in your visual.

  • Brian

Very good.
Thank you so much @BrianJ

Here is another detail workshop just on ranking functions. This goes from beginner up to quite advanced. Discusses the many nuances of dealing with RANKX especially

2 Likes

Great Video Sam and what a great idea to gather all summit videos in just one place.
Very good. Thank you so much!