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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

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...

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@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:-

 

Anonymous
Not applicable

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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.