Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hello friend,
Could you kindly help me to figure out how to rank a calculated table?
I have one table as my original table and based on the original table, I have created a new table to count unique values for each media. I have also added a rank for the new table. The DAX is as follows:
SummarizedTable =
ADDCOLUMNS(
SUMMARIZE(
ALLSELECTED(Data),
Data[Media],
"Unique_Item_Count", DISTINCTCOUNT(Data[HeadlineID])
),
"Rank",
RANKX(ALLSELECTED(Data[Media]), [Unique_Item_Count], , DESC,Dense)
)The result I got is as follows:
I really appreciate if you could help! Thank you.
Solved! Go to Solution.
please try
SummarizedTable =
VAR _t =
SUMMARIZE(
ALLSELECTED('Table'),
'Table'[Media],
"Unique_Item_Count", SUM('Table'[Count])
)
RETURN
ADDCOLUMNS(
_t,
"Rank",
RANKX(_t,[Unique_Item_Count],,DESC,Dense)
)
please try
SummarizedTable =
VAR _t =
SUMMARIZE(
ALLSELECTED('Table'),
'Table'[Media],
"Unique_Item_Count", SUM('Table'[Count])
)
RETURN
ADDCOLUMNS(
_t,
"Rank",
RANKX(_t,[Unique_Item_Count],,DESC,Dense)
)
SummarizedTable = VAR _t= SUMMARIZE( ALLSELECTED('Main Data'), 'Main Data'[Media], "Unique_Item_Count", DISTINCTCOUNT('Main Data'[HeadlineID]) ) RETURN RANKX(_t,[Unique_Item_Count]+RAND(),,DESC,Dense)
Hello thanks for your help again! I am trying to get the ranks for the running total calculation thus I need the ranks to be distinct number. I found somewhere saying that by using RAND() might help to achieve such result. Do you know how to do it? Thanks a millions time!
If you are having trouble with dense and having same rank , it is true you can use rand() which will add a decimal to the total value so [unique measure] + rand() should lpwer the change to get same rank
works perfectly, you are like a magician 😉 Thanks a lot 😊
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 5 | |
| 5 | |
| 4 | |
| 4 | |
| 3 |
| User | Count |
|---|---|
| 24 | |
| 21 | |
| 13 | |
| 10 | |
| 8 |