Skip to main content

Power BI

New

Sort by another column in direct query

Vote (40) Share
Dave Gugg's profile image

Dave Gugg on 15 Sep 2016 21:18:31

Currently you can choose to sort based on another column, such as sorting a month name by the month number. However, this option does not exist in direct query mode. Please extend this functionality to direct query mode.

Comments (8)
Dave Gugg's profile image Profile Picture

507e5235 83c0-4c4c-9a29-5be2372eac79 on 06 Jul 2020 00:12:01

RE: Sort by another column in direct query

This functionality already exists. With a DirectQuery,
in Report Mode, you see no data, yes, but you can see the fields section, choose the column to be sorted, and you can find 'sort by column' is active, then, selection the sequence column to sort by.

Dave Gugg's profile image Profile Picture

1fac0baf 9610-4152-8bad-924d339565a1 on 06 Jul 2020 00:09:53

RE: Sort by another column in direct query

Beef up the Matrix hierarchical sorting functionality as per:
https://ideas.powerbi.com/forums/265200-power-bi-ideas/suggestions/11185431-add-a-multiple-columns-sort-featue 

Dave Gugg's profile image Profile Picture

b26b8fad e329-4318-ac1d-d7c73c620f35 on 05 Jul 2020 23:32:54

RE: Sort by another column in direct query

Sort by column appears for me using DirectQuery, but appears to be limited to non-calculated columns. So for example, I have a text column I'd like to sort in a specific way, and I've created a calculated column to specify the sort order. When I try to sort the text column by the calculated column I get an error saying: "This column can't be sorted by a column that is already sorted, directly or indirectly, by this column." This is no good. Please fix!!

Dave Gugg's profile image Profile Picture

7dc3209f 9677-4ee7-a1b8-0065a7966203 on 05 Jul 2020 23:27:31

RE: Sort by another column in direct query

This is NOT working for me in Direct Query. This sucks!

Dave Gugg's profile image Profile Picture

95f0fe98 f6dc-4739-8dcd-078f6e4ae44b on 05 Jul 2020 23:27:17

RE: Sort by another column in direct query

It's not working in direct query, in my scenario, the data is stored on-premise, and going through the DMG server.

Dave Gugg's profile image Profile Picture

95f0fe98 f6dc-4739-8dcd-078f6e4ae44b on 05 Jul 2020 23:27:17

RE: Sort by another column in direct query

Resolved, was connecting to the power BI Service dataset that is connecting to on-premise SQL Server through DMG. So if I build a new report by connecting to the Power BI Service dataset, then this sort by column is disabled.

So what I have done is to configure that in the Power BI Desktop that connect directly to the SQL Server, made the configuration in the data model and then re-publish into Power BI Service.

Dave Gugg's profile image Profile Picture

b449f788 6482-4a83-b0bd-5e8af497eb92 on 05 Jul 2020 23:14:26

RE: Sort by another column in direct query

This functionality already exists. With a DirectQuery, in Report Mode, in the fields section, highlight the column to be used as the display value, such as 'Month'. Next Under the Modeling menu item, select 'Sort By Column'. Switch the sort by column to the column to be used, such as MonthNumber.

Dave Gugg's profile image Profile Picture

4e8e499d bfaa-41bf-b235-d8458b417fc5 on 05 Jul 2020 22:32:51

RE: Sort by another column in direct query

I am all for this enhancement. In the meantime you have to build the field so it would sort correctly as an alpha field. For example day of week you would have to build the value like this: "10, 21 Fri", "10, 22 Sat", "10, 23 Sun", etc...