Forum Discussion
Issue with TOPN and RANKX with no ties
- Anonymous3 years ago
Hi Anonymous ,
The field [E] is a fact field in the table or a measure? It is a measure, could you please provide its formula? Please create a measure as below and check if you can get the correct rank values...
RANKING = RANKX ( ALLSELECTED ( 'Table' ), CALCULATE ( SUM ( 'Table'[E] ) ),,, DENSE )In addition, you can refer the following threads to solve your problem.
Rank Product = RANKX ( ALL ( MyData[Product] ), CALCULATE ( SUM ( MyData[Quantity] ), ALLEXCEPT ( MyData, MyData[Product] ) ) )Total Sales = SUM ( sales[sales amount] ) SalesRank = RANKX ( ALLSELECTED ( sales[employee number] ), [Total Sales] )If the above one can't help you get the desired result, please provide some raw(fake) data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.
How to upload PBI in Community
Best Regards
If I am doing it without the aggregation on the TableName[E] then it shows me the following error
A single value for column ColumnName in Table TableName cannot be determined and not allowing me to move forward. However, if I am applying the aggregation it still shows RANK as 1 for all of the rows.
the code is used to create a new column. Are you creating a measure?
- Anonymous3 years agoNot applicable
I am not creating a measure, it is an exisiting column, but if I am not using Aggregation DAX like SUM it gives me the above mentioned error.
- Anonymous3 years agoNot applicable
Sorry was unable to reply due to max limits on private message.
Please find the screenshot below for the measure I have generated.
- Anonymous3 years agoNot applicable
Hi Anonymous ,
The field [E] is a fact field in the table or a measure? It is a measure, could you please provide its formula? Please create a measure as below and check if you can get the correct rank values...
RANKING = RANKX ( ALLSELECTED ( 'Table' ), CALCULATE ( SUM ( 'Table'[E] ) ),,, DENSE )In addition, you can refer the following threads to solve your problem.
Rank Product = RANKX ( ALL ( MyData[Product] ), CALCULATE ( SUM ( MyData[Quantity] ), ALLEXCEPT ( MyData, MyData[Product] ) ) )Total Sales = SUM ( sales[sales amount] ) SalesRank = RANKX ( ALLSELECTED ( sales[employee number] ), [Total Sales] )If the above one can't help you get the desired result, please provide some raw(fake) data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.
How to upload PBI in Community
Best Regards
- FreemanZ3 years ago
Super User
have to see the names for the table and column. Could replace them with dummy code?