Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
navneet0512
Helper III
Helper III

Rank basis on count of order number. .

 

Serial No = RANKX(ALLSELECTED('Query1'),CALCULATE(DISTINCTCOUNT('Query1'[OrderNumber])),, DESC, Dense)
3 REPLIES 3
amitchandak
Super User
Super User

@navneet0512 , what is the issue?

 

It always better to have rank with explicit column  and with a measure

 

m1 = CALCULATE(DISTINCTCOUNT('Query1'[OrderNumber]))

 

Serial No = RANKX(ALLSELECTED('Query1'[SPAC]'Query1'[SpanFacility], 'Query1'[Transport mode], 'Query1'[Serial no],'Query1'[Postal Code]),[M1],, DESC, Dense)

 

 

or create a visual calculation

 

Serial No = RANKX(ROWS,[M1],, DESC, Dense)

 


Next-Level Power BI Visual Calculations with Offset, Index, Rank, RowNumber, And Rankx:https://medium.com/microsoft-power-bi/next-level-power-bi-visual-calculations-with-offset-index-rank...

@amitchandak Still facing below issues:-
First Step:- 

OrderCount = CALCULATE(DISTINCTCOUNT('Query1'[OrderNumber]))
Step2:-
Ranktest = RANKX(ALLSELECTED('Query1'[SCAC], 'Query1'[Spamsfacility],Query1[TransportMode],Query1[PostalCode] ),[OrderCount],, DESC, Dense)

But Still facing repeating of rank:-

 

Hi,

Thanks for the solution @amitchandak  provided, and i want to offer some more information for user to refer to.

hello @navneet0512 , based on your description, you can refer to the following sample

Sample data 

vxinruzhumsft_0-1714014956675.png

Create the rank measure

Measure = RANKX(ALLSELECTED('Table'[Product]),CALCULATE(DISTINCTCOUNT('Table'[IDNumber])),,ASC)

Output

vxinruzhumsft_1-1714015036383.png

 

You need to select the column you want to rank, in this case , i want to rank the product column, so in measure i use allselected(table[product]).

 

Best Regards!

Yolo Zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.