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.
Hello,
I created a table in Power BI that contains the following columns + one measure
1. Run Date --> Column
2. Facility Code --> Column
3. Facility Name --> Column
4. Overall Score --> Measure
**This table is filtered (Slicer) by "Run Date".
I sorted the table in order by Overall Score (highest value to lowest value) but would like to add a column next to it that shows the rank of each score (ex: 1, 2, 3, 4).
I entered the formula below to rank the overall score but when I pull the measure into the table, I get a value of 2 for each row and there are 79 rows.
I was expecting to see 1 through 79 where the highest overall score contains a number of 1 and the lowest contains a number of 79.
Solved! Go to Solution.
Hi @gmasta1129 ,
Please try if this gives you the desired result that you are looking for. Thanks
RankX =
RANKX(
ALL('Table'[Facility Code] , 'Table'[Facility Name] , 'Table'[Run Date])
[Overall Score],
,
DESC,
DENSE
)
Hi @gmasta1129,
Thanks for reaching out to the Microsoft fabric community forum.
I fixed the ranking issue where all facilities showed rank 1 when filtered by changing the ranking logic. Originally, the rank was calculated only within the filtered data context, causing it to reset and show 1 for every filtered row.
To solve this, I used a DAX formula that ranks each facility’s overall score against all facilities in the dataset, ignoring any filters. This way, the rank stays accurate even if you filter for a single facility or date. We rank in descending order so the highest score is rank 1, and we use dense ranking to avoid gaps in ranking numbers when scores tie.
Here’s the DAX measure I used:
DAXCopyEditRank by Overall Score =
RANKX(
ALL('FacilityScores'),
[Overall Score],
,
DESC,
DENSE
)
Find attached .PBIX for your reference.
If the response has addressed your query, please Accept it as a solution and give a 'Kudos' so other members can easily find it.
Best Regards,
Tejaswi.
Hi @gmasta1129 ,
Please try if this gives you the desired result that you are looking for. Thanks
RankX =
RANKX(
ALL('Table'[Facility Code] , 'Table'[Facility Name] , 'Table'[Run Date])
[Overall Score],
,
DESC,
DENSE
)
The formula worked.
Thank you for your help! 🙂
Hello @SamsonTruong ,
Thanks for the quick response. I entered the formula and pulled the measure into my table. I see a value of 1 for each row.
Hi @gmasta1129 , by any chance can you attach the DAX for the Overall Score measure?
Additionally, can you try the following DAX measure:
Rank by Score =
RANKX(
ALLSELECTED('Table'[Facility Code]),
CALCULATE([Overall Score]),
,
DESC,
DENSE
)
Hi @gmasta1129 ,
Please let me know if the measure below achieves the result you are looking for:
Rank by Score =
RANKX(
ALLSELECTED('Table'[Facility Code]),
[Overall Score],
,
DESC,
DENSE
)
If this helped, please mark it as the solution so others can benefit too. And if you found it useful, kudos are always appreciated.
Thanks,
Samson
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 |
---|---|
17 | |
9 | |
8 | |
7 | |
7 |