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

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

Reply
vibhoryadav23
Helper II
Helper II

Ranking on multiple columns

Hi all,

 

I want to create ranking in the data table (not in a visual) based on 2 categories (Column1,2) instead of 1 like in example below. Can someone help with the ranking formula to create a new ranking column instead of creating a new measure. Thanks in advance!

Column1  Sales  Rank
A  10  2
A  5  3
A  15  1
B  20  2
B  30  1
B  10  3
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @vibhoryadav23 ,

 

1. If your third column is the result you expect, you can create a calculated column and use the rankx function to sort. For detailed information, please refer to the document: RANKX function (DAX) - DAX | Microsoft Learn.

Ranking =
RANKX(
FILTER(
'Table',
'Table'[Column1] = EARLIER('Table'[Column1])
),
'Table'[Sales],
,
DESC,
Dense
)

2. If you want to sort the data in the second column according to size, you can place the fields in the table visual and adjust the sorting through the small triangle under the column name.

vkaiyuemsft_0-1709108728635.png

If your Current Period does not refer to this, please clarify in a follow-up reply.

 

Best Regards,

Clara Gong

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

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @vibhoryadav23 ,

 

1. If your third column is the result you expect, you can create a calculated column and use the rankx function to sort. For detailed information, please refer to the document: RANKX function (DAX) - DAX | Microsoft Learn.

Ranking =
RANKX(
FILTER(
'Table',
'Table'[Column1] = EARLIER('Table'[Column1])
),
'Table'[Sales],
,
DESC,
Dense
)

2. If you want to sort the data in the second column according to size, you can place the fields in the table visual and adjust the sorting through the small triangle under the column name.

vkaiyuemsft_0-1709108728635.png

If your Current Period does not refer to this, please clarify in a follow-up reply.

 

Best Regards,

Clara Gong

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

Syk
Super User
Super User

How are you wanting the ranking to work? 
A, Product 1 = 1
A, Product 2 = 2
B, Product 1 = 3

B, Product 2 = 4

?

Sorry, the table posted was the wrong one. Updated the same. Column3, 'Rank' is the expected outcome based on first 2 columns. Thanks.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.