Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
robmarsh
Frequent Visitor

Column Sorting in Direct Query

Hi,

 

Hoping someone can help point me in the right direction, I'm pretty sure I am missing something obvious as what I am trying to achieve is pretty straight forward. However, my searches on the forum posts have not brought up any solutions.

 

So, I have a Direct Query that I want to sort on multiple columns within the query itself. I then want to display the results in a table and apply the same sorting as embedded into the Direct Query SQL code. However, I can't seem to get it to work at all.

 

I can't sort the columns in the Edit Query window as this fucntionality isn't supported when using a Direct Query. Neither can I add the columns to the table (even though I dont want to see them) and sort there as it only seems to support sorting on one column at a time.

 

Thanks for looking 🙂

2 REPLIES 2
JirkaZ
Solution Specialist
Solution Specialist

@robmarsh Are you using a custom SQL command to connect to the SQL data? With this option sorting is not allowed as you can specify it in the command. 
If you'd use the SQL browser and select the tables you need, then sorting would be allowed and offloaded to the SQL Server.

@JirkaZ thanks for the reply. Yes I am using a custom SQL command, and I am already applying the column sorts in that command. This is why I am confused as to why or how it is deciding to sort by something else, or just ignore my sorting completely.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.