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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
robmarsh
Helper I
Helper I

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
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors