Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount.
Register nowThe Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.
Was wondering if anyone could help me. I have a DAX measure that calculates total sales from my raw data.
My billings data also has relationship with my customer table so I can see total sales by customer. I want to create a Rank measure within this visual to show ranking by customer. However, the RANKX measure only allows me to use a column as value.
i.e. RANKX(ALL('Customer'[Customer ID],[column ref here]))
Was wondering if there was a way to use DAX measure and not a column or calculated column to do the RANKX measure. If not, whether there is an alternate way to create a ranking measure?
Solved! Go to Solution.
Hi @Imrans123 ,
I have listed three common cases according to your dax, 1, normal sorting 2, group sorting 3, summary sorting, the following pbix contains the columns for these three kinds of sorting, and the MEASURE, you can refer to my file and adjust it according to your environment.
1.test1 and test11 normal sorting
2.test2 and test22 group sorting
3.test3 and test33 summary sorting
Did I answer your question? Mark my post as a solution!
Best Regards
Lucien
Hi @Imrans123 ,
I have listed three common cases according to your dax, 1, normal sorting 2, group sorting 3, summary sorting, the following pbix contains the columns for these three kinds of sorting, and the MEASURE, you can refer to my file and adjust it according to your environment.
1.test1 and test11 normal sorting
2.test2 and test22 group sorting
3.test3 and test33 summary sorting
Did I answer your question? Mark my post as a solution!
Best Regards
Lucien
Hi:
You can use:
RANKX(
CALCULATETABLE(
SUMMARIZE(
'Sales',
Customers[Name]
),
ALL(Customers[Name])),
[Total Sales], , DESC)
Thanks a lot. A little confused, was wondering if you could explain
So if I understand correctly, SUMMARIZE('Sales', Customers[Name]...
Shouln't be group by from the Customer table? i.e. Summarize('Customers','Customers'[Name]...
I'll try writing with your columns in mind
RANKX(
CALCULATETABLE(
SUMMARIZE(
'Billings',
Customers[ID]
),
ALL(Customers[ID])),
[Total Sales], , DESC)
Hi:
Yes Summarize(Billings[Customer ID] I used Sales[Customer name] which may have thrown it off. Essentially, it will go thru all the sales records by customer (a virtual table) to determine the ranking for each customer.
Hi @Imrans123
You can use a virtual column or table into a Variable nested into a measure.
Regards
Amine Jerbi
If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook
User | Count |
---|---|
134 | |
74 | |
72 | |
58 | |
54 |
User | Count |
---|---|
194 | |
95 | |
65 | |
62 | |
53 |