Forum Discussion
Make continuous ranking if values are the same
Hi,
Well known issue, but the related posts mostly contain solutions based on a column by adding an index. My problem however, is that I created the ranking based on a measure.
I created a rankingmeasure based on a count measure, see below:
Intakes = COUNT(Intakes[Id])
Any suggestions on how to solve this. Tried to check related topics but these mostly contains rankings based on columns instead of measures. Thanks in advance!
Kind Regards,
Soof1234
Hi,
Thank you for your message, and please check the below picture and the attached pbix file.
Rank: = VAR _table = ADDCOLUMNS ( ADDCOLUMNS ( ALL ( Intakes[Sourcers.Title] ), "@rankone", CALCULATE ( RANKX ( ALL ( Intakes[Sourcers.Title] ), [Intakes:],, DESC ) ), "@ranktwo", CALCULATE ( RANKX ( ALL ( Intakes[Sourcers.Title] ), CALCULATE ( MAX ( Intakes[Sourcers.Title] ) ), , ASC ) ) ), "@newindex", [@rankone] * 100 + [@ranktwo] ) VAR _newtable = ADDCOLUMNS ( _table, "@newrank", RANKX ( _table, [@newindex],, ASC ) ) RETURN IF ( HASONEVALUE ( Intakes[Sourcers.Title] ), MAXX ( FILTER ( _newtable, Intakes[Sourcers.Title] = MAX ( Intakes[Sourcers.Title] ) ), [@newrank] ) )
10 Replies
- Jihwan_KimSuper User
Hi,
I am not sure how your data model looks like, but I tried to create a sample pbix file like below.
Please check the below picture and the attached pbix file.
I hope the below can provide some ideas on how to create a solution for your data model.
Rank expected result: = COUNTROWS ( WINDOW ( 1, ABS, 0, REL, SUMMARIZE ( ALL ( Data ), Data[Name], Data[Qty] ), ORDERBY ( Data[Qty], DESC, Data[Name], ASC ) ) )- Soof1234Helper I
Hi Jihwan_Kim ,
Didnt work unfortunately. I cant upload a file here because of user level probably.
My table looks like this
Sourcers.Title Kevin Jane Kevin Jane Rob Joy Joy Kevin Jane Intakes = COUNT(Intakes[Sourcers.Title])Ranking = RANKX( ALL(Intakes[Sourcers.Title]),[Intakes])
Based on these measures, the tablevisual would look like this:Rank Sourcers.Title Intakes 1 Kevin 3 1 Jane 3 3 Joy 2 4 Rob 1 What i want to achieve is that either jane or kevin gets ranking 2, this could be based on alphabetical order for example. Hope this is clear enough for you.Kind Regards,Soof1234- Jihwan_KimSuper User
Hi,
Thank you for your message, and please check the below picture and the attached pbix file.
Rank: = VAR _table = ADDCOLUMNS ( ADDCOLUMNS ( ALL ( Intakes[Sourcers.Title] ), "@rankone", CALCULATE ( RANKX ( ALL ( Intakes[Sourcers.Title] ), [Intakes:],, DESC ) ), "@ranktwo", CALCULATE ( RANKX ( ALL ( Intakes[Sourcers.Title] ), CALCULATE ( MAX ( Intakes[Sourcers.Title] ) ), , ASC ) ) ), "@newindex", [@rankone] * 100 + [@ranktwo] ) VAR _newtable = ADDCOLUMNS ( _table, "@newrank", RANKX ( _table, [@newindex],, ASC ) ) RETURN IF ( HASONEVALUE ( Intakes[Sourcers.Title] ), MAXX ( FILTER ( _newtable, Intakes[Sourcers.Title] = MAX ( Intakes[Sourcers.Title] ) ), [@newrank] ) )
- SaiChandNew Member
Greate Job Jihwan_Kim,
It worked for me, really appreciate your work.