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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
nirvana_moksh
Impactful Individual
Impactful Individual

Preserve sort order returned by SQL Query

Hello,

 

I was wondering if anyone knows how to preserve the sort order of a source when importing data from a SQL query. There is no order by defined, but the way the data is returned in regards to the sorting, can that be retained? If not will the addition of Order By in the SQL Query help? If that again is not possible, is the only way to do this is by sorting by different column names, or by defining a sort value column?

 

Thank You

1 ACCEPTED SOLUTION
v-lili6-msft
Community Support
Community Support

hi, @nirvana_moksh 

It will keep the same sort order with SQL query code.

If there is order by defined, it will keep the same sort order too.

 

Best regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-lili6-msft
Community Support
Community Support

hi, @nirvana_moksh 

It will keep the same sort order with SQL query code.

If there is order by defined, it will keep the same sort order too.

 

Best regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi have the same problem but it think the problem is more related with the visualization table.

 

I have a view in SQL server, the view has a specif sorting (ORDER BY), when I "get the data" and go to "Trasform Data" view, the data looks OK, but when I load the data to a "Table", I'm missing the sort of my view.

 

Is this a bug of visualization table?

 

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors