Forum Discussion
Adding index in a calculated table for sorting purposes
- Anonymous6 years ago
Hi Anonymous ,
One way is to add the calculated column to tooltips filed of the visual as tex628 mentioned and click "..." on the visual then sort by calculated column.
Another way is create a custom column in Query Editor and sort the column1 by the custom column (no need to add custom column to tooltips field).
But as you said your table is a calculated table so the second way is not suitable for your current scenario but you might use it someday😁
Best Regards,
Jay
Community Support Team _ Jay Wang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi,
Create a calculated column in 'Table' that looks at the different values in [State].
Use something like this:
Column =
SWITCH( [State];
"0-2" ; 0 ;
"3-5" ; 1 ;
"6-12" ; 2 ;
etc...
)
Then finally sort your [State] solumn using your new index column. Use the "Sort by column" functionality.
Br,
J
- Anonymous6 years agoNot applicable
Hi tex628!
I've used the Switch function, but when trying to apply the sorting I got the error below. Can you advise?
Thanks.
- tex6286 years ago
Community Champion
My bad, PBI doesn't like it when you try to sort a column with another one that is dependant on the first.
But the index column that we created isn't completly useless, if you drag it into the tooltip slot in the chart you can then directly sort the chart on that index column.
If you don't want to have the index column in the tooltip you will need to recreate the table in power query instead, if you do you should not get the issue when you use "sort by column".
If you need any help with setting up the table in power query, just give me the word! 🙂
Br,
J