Skip to main content
Microsoft Idea

Power BI

Needs Votes

Allow the use of ORDER BY when querying a SQL Server View in DirectQuery

Vote (27) Share
's profile image

on 04 Dec 2018 23:23:12

When using PowerBI in DirectQuery, you cannot query a SQL Server View with an ORDER BY without receiving the SQL Server error message

"The ORDER BY clause is invalid in views, inline functions, derived tables, subqueries, and common table expressions, unless TOP, OFFSET or FOR XML is also specified."

While I understand we cannot include an ORDER BY in the SQL Server View Definition, we should still be able to issue an ORDER BY against a pre-defined View (or utilize the Query Editor for Direct Query for sorting, etc.)

Comments (2)
's profile image Profile Picture

Power BI User on 06 Jul 2020 00:00:57

RE: Allow the use of ORDER BY when querying a SQL Server View in DirectQuery

Write the query into stored procedure and execute it through power get data option

's profile image Profile Picture

LSU BOB on 05 Jul 2020 23:48:47

RE: Allow the use of ORDER BY when querying a SQL Server View in DirectQuery

Any resolution or workaround to this problem?