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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric 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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.