Showing results for 
Search instead for 
Did you mean: 
Rodion Frequent Visitor
Frequent Visitor

Re: Modify the legend order

Stephan's solution looks perfect to my situation, but I don't see the "New group" option if if select the arrow. I only see the options "Delete field", "Change name" and "Show items whithout data". Has the "New group" option been deleted or am I looking at the wrong place?

dapster105 Frequent Visitor
Frequent Visitor

Re: Modify the legend order


I would like to offer other web visitors what I think is an even better invisble solution in some circumstances, which is to prefix your text with a number of unicode 'zero width space' characters (


Each of these characters has a code, and PowerBI will honour it in its default sorting, but the characters are not visible. Therefore you can add as many as you like. The more you add, the earlier the string will sort.


In my case, I do this in the SQL view definition which is the source of data for PowerBI e.g.


SELECT CASE [somenvarcharfield] WHEN 'alpha' THEN NCHAR(8203)+'alpha' WHEN 'beta' THEN...... 


e.g. producing the following strings in SQL...





Will produce the visible sort order in PowerBI...





It may be possible to inject these unicode characters straight into the PowerBI user interface but I haven't tested this - the above works well for me and I generally stick to doing as much work in the view (rather than in PowerBI) as possible.


I hope this helps someone else.