Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for a $400 discount.
Register nowGet inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.
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.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the February 2025 Power BI update to learn about new features.
User | Count |
---|---|
24 | |
12 | |
10 | |
9 | |
9 |
User | Count |
---|---|
17 | |
16 | |
13 | |
11 | |
11 |