The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
I am attempting to create the simplest of Rank measures! I have a single table (SalesData) of data, with a column called "Cost of Sales".
I want to create a basic rankx function which ranks a dimension by the Cost of Sales. Sounds simple! But I cannot get this to show a result other than 1 every time no matter how I write this DAX. Any suggestions? I am sure it's something daft!
You can download a sample here.
Just click on the download link at top right to download the PBIX.
Thanks!
Solved! Go to Solution.
Hello,
You were on the right track by using ALL. The only issue now is that since you remove all filters the values are same for all rows so every row returns one. By adding a column reference the calculation should work. E.g. all(SalesTable[Region])
I recommend checking this article by SQLBI: Introducing RANKX in DAX - SQLBI
I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!
My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/
Proud to be a Super User!
Whilst @ValtteriN solution works, I am still a bit confused about this. Reviewing several articles about this function, the implication is you can simply use a format like RANKX(SalesTable, [COS Measure]).
Eg https://databear.com/how-to-use-the-dax-rankx-function-in-power-bi/
In this article it states:
Thank you @ValtteriN .
So this was the solution:
Hello,
You were on the right track by using ALL. The only issue now is that since you remove all filters the values are same for all rows so every row returns one. By adding a column reference the calculation should work. E.g. all(SalesTable[Region])
I recommend checking this article by SQLBI: Introducing RANKX in DAX - SQLBI
I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!
My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/
Proud to be a Super User!
User | Count |
---|---|
15 | |
12 | |
8 | |
7 | |
7 |
User | Count |
---|---|
24 | |
21 | |
12 | |
10 | |
7 |