Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Custom sorting in PowerBI chart

Recently I came across one issue in which I need to show the column order as per my defined way in PowerBi report. Thing is, PowerBI sorts the columns in either Ascending(A->Z) or descending(Z->A) order, then if one has to apply his custom order how he should achieve this?

Here is and example

Here we can see the order on X-Axis is ascending or we can show it descending, but what if i would like to sort the order with respect to my need; may be as below :

1.2 Wheel Preview --> 1.2 GTR --> 1.2 Ultra --> 1.2 RTR

, Would it be possible in PowerBI desktop while creating the report, if yes, then guidelines to be followed will be well appreciated. :)

Thanks.

like image 246
Abhi Avatar asked Jul 04 '16 13:07

Abhi


1 Answers

Add a column to your source data and populate it with values for the desired sort order. Then select the column you want to custom sort and click Modeling > Sort by Column. Select the new column as the SortBy column for the existing column, like in the screenshot: The SortCategory column is used as the sort order for the Category column.

enter image description here

Now create a chart and the categories on the axis will be sorted according to the values of the SortCategory column.

enter image description here

like image 91
teylyn Avatar answered Sep 20 '22 13:09

teylyn