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.
Hey everyone, I wanted to share an issue I encountered while working with the DAX RANK function in Power BI.
I noticed that this function works with some columns from my dimension, but not with others in the same dimension.
So here is my working code
__Rank =
var _relevantProducts =
ADDCOLUMNS
(
ALLSELECTED ( Produkte[StabileArtikelNr mit Nummer] )
, "@Umsatz", [Umsatz]
)
RETURN
IF (NOT ISBLANK([Umsatz] )
,
RANK
(
DENSE
, _relevantProducts
, ORDERBY
(
[@Umsatz]
, DESC
, Produkte[StabileArtikelNr mit Nummer]
, ASC
)
)
)
So my ranking works as expected
But now, if I want to use another column from the same dimension in the matrix and change also my code to
__Rank =
var _relevantProducts =
ADDCOLUMNS
(
ALLSELECTED ( Produkte[Stabile ArtikelNr Bezeichnung] )
, "@Umsatz", [Umsatz]
)
RETURN
IF (NOT ISBLANK([Umsatz] )
,
RANK
(
DENSE
, _relevantProducts
, ORDERBY
(
[@Umsatz]
, DESC
, Produkte[Stabile ArtikelNr Bezeichnung]
, ASC
)
)
)
I get the following result:
As you can see, I only changed the column in my ALLSELECTED()-Part and in the RANK-Part.
Has anyone else experienced this issue or is there something wrong in my code?
Looking forward to hearing your thoughts and suggestions. Thanks!
Hi @tkiwi ,
Based on the description, for the Stabile ArtikelNr Bezeichnung column , the rows have the same ranking. It is normal for the row to have the same ranking when using rank dax.
Rank function have some limitations. If the columns specified within orderby and partitonby cannot uniquely identify every row in relation, then two or more rows may have same ranking.
Then, try to verify the data type of the column and check the values.
Besides, ALLSELECTED function gets the context that represents all rows and columns in the query.
Viewing the following documents to learn more information.
RANK function (DAX) - DAX | Microsoft Learn
ALLSELECTED function (DAX) - DAX | Microsoft Learn
Solved: Rankx not displaying ranking properly - Microsoft Fabric Community
Best Regards,
Wisdom Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
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 | |
11 | |
10 | |
9 | |
8 |
User | Count |
---|---|
17 | |
13 | |
12 | |
11 | |
9 |