Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hi all,
I have a duplicate ranking issue. At an overall level, it's fine, however bringing in multiple columns creates duplicate rankings.
As you can see overall is fine, but group 1 has multiple 12's. I want unique rankings for each category based on it's volume. This is my formula:
Hi, @Sammm888
First, create a Index in PowerQuery.
Then click Apply&Close.
Create a calculated column, and treat the Index you just created as a secondary sort, which must be uniquely identified and cannot have duplicate values. Otherwise, when your sort has the same value and the sub-sort value is the same, the rank will be the same. Here is my preview:
Column = ROWNUMBER(ORDERBY('Table'[Totalvols],DESC,'Table'[Index],ASC))
How to Get Your Question Answered Quickly
Best Regards
Yongkang Hua
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@Anonymous - I dont agree with this solution, though you are correct, it removes the duplicates. In terms of ranking, the duplicates are legitamately there.
If a business user was to ask what the criteria was for separating the items that have 100 as a total volume, the answer would be "random chance" and that's not acceptable. It could lead to a poor decision being made by an organisation.
@Sammm888 - firstly you need to include all columns from your visual in the ranking, this is what is causing your duplication, secondly I would suggest putting the filtering on the visual and taking it out of the ranking. Please try the code below:
RANKX (ALLSELECTED('Table1'[SubCat], 'Table1'[Group]),[Totalvols],,DESC)
If you find you still need the filtering, you can use the ALLSELECTED from my code, rather than the ALL from yours.
If this works, please accept this as the solution, if it does not, please supply some sample data for me to test.
Sadly this is now ranking across all columns rather ranking for each individual column. I will try and provide sample data, but need to remove sensitive data first.
@Sammm888 - Sorry for the late response, I have been travelling a lot the last 2 days.
I misread your challenge the first time, so my code was not going to work for you, sorry about that.
Having seen your screenshot, I can see why you have duplicate rankings. In group 1 you have 3 [Totalvols] of 89, 3 [Totalvols] of 117 and 3 visible 153's.
These will all be producing duplicate ranks because they have the same value. If you want them to have different ranks, you need to provide another measure to break the ties.
Hi,
These are not the volumes, this is the output of your code. There are very few rows that have the same volumes
I see, then we still need some sample data to understand why you are getting duplicates.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
11 | |
10 | |
10 | |
9 | |
8 |
User | Count |
---|---|
16 | |
13 | |
12 | |
11 | |
8 |