Forum Discussion
Ranking a column in a table
- 5 years ago
Hi, Anonymous
You don’t have to use a measure to rank the value of [LFT Purchase], you can just do it in power query editor, you can follow my steps:
- Open power query editor, select the table, select the column you want to rank, and choose sort descending, like this:
- Add an index column, like this:
- Rename this column, and put them into a table chart, like this:
If you still want to achieve this in DAX, you can try this calculated column:
Rank = RANKX(PBI,MAX('PBI'[LFT Purchase]),,DESC)
If you this way is not suitable for your requirement, you can reply to me and post some sample data(without sensitive data) and your expected result.
Here are some good blog that tell how to sort columns using dax, you can follow these links to learn more about sorting in power bi:
https://www.wiseowl.co.uk/blog/s2469/rankx-function.htm
https://powerbi.tips/2019/09/custom-sort-order-within-a-dax-measure/
Best Regards,
Community Support Team _Robert Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, Anonymous
You don’t have to use a measure to rank the value of [LFT Purchase], you can just do it in power query editor, you can follow my steps:
- Open power query editor, select the table, select the column you want to rank, and choose sort descending, like this:
- Add an index column, like this:
- Rename this column, and put them into a table chart, like this:
If you still want to achieve this in DAX, you can try this calculated column:
Rank = RANKX(PBI,MAX('PBI'[LFT Purchase]),,DESC)
If you this way is not suitable for your requirement, you can reply to me and post some sample data(without sensitive data) and your expected result.
Here are some good blog that tell how to sort columns using dax, you can follow these links to learn more about sorting in power bi:
https://www.wiseowl.co.uk/blog/s2469/rankx-function.htm
https://powerbi.tips/2019/09/custom-sort-order-within-a-dax-measure/
Best Regards,
Community Support Team _Robert Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.