Forum Discussion
Sort by another column error
- 10 years ago
This is one of those time where I don't think the error message is entirely helpful, and I'm not even sure why it's an issue. What it really means is that you can't sort by a column that depends on the column you want sorted. You can see the same problem here in Power Query and Power Pivot.
As a workaround, can you recreate the Sort Order in the Query Editor? If you go to Edit Queries, you can use the Add Custom Column feature in the Add Column tab in the ribbon. Use this formula:
=if [Category]="A" then 1 else if [Category]="C" then 2 else if [Category]="B" then 3 else 0
You have to end with an "else" which is the only reason I end with else 0. If you know you'll only have A, B, and C values in Category, it won't hurt anything, but neither will:
if [Category]="A" then 1 else if [Category]="C" then 2 else 3
That will create the Sort Order column. If you prefer a UI to writing the formula by hand, you can alternatively use the Conditional Column under Add Column:
Once you Close and Apply, you can then go to the Data pane and sort your Category column by Sort Order.
I am facing a similar issue on a summarized table. Hence I can't add a column in edit queries mode.
Is there a workaround for this?
Could you specify what you're trying to do?
- mulcay7 years agoNew Member
Since the calculated tables do not appear ampong the tables in edit query, i also can not add a conditional column to create a sort order column. I guess that's what she means.
Thanks