Forum Discussion
Reset INDEX order when data sort does not give the results
- 10 years ago
kfschaefer wrote:
thanks for the code, however, it seems to have and issue with the 4.
I thought you were adding a column in the modeling lab with DAX, the switch is a DAX function.
To add a column with the same logic in the Query Editor which Power Query is used, you can reference below expression.if [live range]="0-100" then 1 else( if [live range]="101-500" then 2 else( if [live range]="501-3000" then 3 else( if [live range]="3000+" then 4 else( if [live range]="New" then 5 else( if [live range]="Runout" then 6 else 999)))))
If you have any question, feel free to let me know.
kfschaefer I'm not really sure if this is what your after, but you can sorty your Lives Range column by the index column so it always returns in proper index order. Go to modeling tab - highlight the Lives Range - select Sort by column in top ribbon and sort by index.
- kfschaefer10 years ago
Helper IV
However the 3000+ is sorted out of order when I use the Index column.
I need the 3000+ to be displayed after the 500-3000 record, hence the need for manual changing the index to correct this issue.
Thanks for your input.
- Anonymous10 years agoNot applicable
kfschaefer It sounds like you just need another column to sort by. Eric_Zhang provides you with the path to create that new column, but you can manually build it as well. Just create a column that would correspond to the correct order and sort by that column for the order that you want... Is there something else I'm missing?
- kfschaefer10 years ago
Helper IV
There is a minor issue with his solution, waiting on reply.