This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. We're covering it all. You won't want to miss it.
Learn moreLevel up your Power BI skills this month - build one visual each week and tell better stories with data! Get started
Hello Power BI community!
Need some urgent help in converting the following measure to a calculated column. The min purpose is that I can use this new column as a legend for my pie chart.
Ranking SingleSelect =
RANKX(ALLSELECTED('df_Search Order (First)'[Search Order (First)]), [Category_Occasion_SingleSelect%], , DESC, Dense)@MFelix , @amitchandak , @Ashish_Mathur
Solved! Go to Solution.
Hi, @Anonymous
Thank you very much for your reply. Here's how I handle ranking with measure in calculated columns:
1. First of all, use the summarize function to summarize the measure, here I simply create a measure as shown in the following photos:
I use the following DAX to call this measure and generate a calculation table:
Table =
SUMMARIZE (
'df_Search Order (First)',
'df_Search Order (First)'[Search Order (First)],
"result", [category_Occasion_%]
)
Here are the results:
You need to replace [category_Occasion_%] with your measure.
2. Create a connection for the two tables:
3.The following DAX is used for ranking in the original table:
Ranking SingleSelect =
RANKX ( 'df_Search Order (First)', RELATED ( 'Table'[result] ),, DESC, SKIP )
Here are the results:
Hi, @Anonymous
Based on your DAX, I used the following sample data:
I'm using the following DAX expression in the calculated column for ranking:
Ranking SingleSelect =
RANKX (
'df_Search Order (First)',
[Category_Occasion_SingleSelect%],
,
DESC,
DENSE
)
Here are the results:
How to Get Your Question Answered Quickly
If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .
Best Regards
Jianpeng Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hello @Anonymous
Thanks for helping here!
But I'm getting this error here when I run this code. This might be because [Category_Occasion_SingleSelect%] is a measure. Can there be another way?
Also, I'm trying to convert this into a column because I want to use this as a legend in my pie chart. But I cannot add a measure as a legend.
Hi, @Anonymous
Thank you very much for your reply. Here's how I handle ranking with measure in calculated columns:
1. First of all, use the summarize function to summarize the measure, here I simply create a measure as shown in the following photos:
I use the following DAX to call this measure and generate a calculation table:
Table =
SUMMARIZE (
'df_Search Order (First)',
'df_Search Order (First)'[Search Order (First)],
"result", [category_Occasion_%]
)
Here are the results:
You need to replace [category_Occasion_%] with your measure.
2. Create a connection for the two tables:
3.The following DAX is used for ranking in the original table:
Ranking SingleSelect =
RANKX ( 'df_Search Order (First)', RELATED ( 'Table'[result] ),, DESC, SKIP )
Here are the results:
Hello @Anonymous,
Can you please try the following:
Ranking SingleSelect =
RANKX(
ALL('df_Search Order (First)'),
CALCULATE(SUM('df_Search Order (First)'[Category_Occasion_SingleSelect%])),
,
DESC,
Dense
)
Hello @Sahir_Maharaj
Thanks for helping here!
But I'm getting this error here when I run this code. This might be because [Category_Occasion_SingleSelect%] is a measure. Can there be another way?
Also, I'm trying to convert this into a column because I want to use this as a legend in my pie chart. But I cannot add a measure as a legend.
This here is a forum where users help users, time permitting. For urgent requests contact a Microsoft partner near you.
Please provide a more detailed explanation of what you are aiming to achieve. What have you tried and where are you stuck?
Check out the April 2026 Power BI update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 5 | |
| 4 | |
| 3 | |
| 3 | |
| 3 |
| User | Count |
|---|---|
| 9 | |
| 9 | |
| 7 | |
| 6 | |
| 6 |