Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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 |
Solved! Go to Solution.
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.
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.
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.
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.
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.
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
20 | |
7 | |
6 | |
5 | |
5 |
User | Count |
---|---|
26 | |
10 | |
10 | |
9 | |
6 |