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

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
ak77
Post Patron
Post Patron

Error while Direct Query Option

Hi All,

 

I am using Direct option while retrieving data from SQL server and gettting below error . but this sql query works perfectly with import mode..  so is there a limitation using direct option? please let me know

 

Microsoft SQL: Incorrect syntax near the keyword 'WITH'.
Incorrect syntax near the keyword 'with'. If this statement is a common table expression, an xmlnamespaces clause or a change tracking context clause, the previous statement must be terminated with a semicolon.
Incorrect syntax near ','.
Incorrect syntax near ')'.

 

 

 

 

2 REPLIES 2
Anonymous
Not applicable

Hi @ak77 ,

 

Thanks to @ExcelMonke  for their replies and allow me to provide another insight:

 

There are a number of potential negatives associated with using DirectQuery. Some of these limitations will vary slightly depending on the exact source you are using. This document lists the general implications of using DirectQuery, as well as limitations related to performance, security, transformations, modelling and reporting.

DirectQuery in Power BI - Power BI | Microsoft Learn

 

In addition, here are solutions to problems similar to yours that we hope will help you:
Solved: Power query loads but errors on close and apply - Microsoft Fabric Community

 

If your Current Period does not refer to this, please clarify in a follow-up reply.

 

Best Regards,

Clara Gong

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

ExcelMonke
Super User
Super User

Whilst I can't tell you exactly what is going on with the query, I have run into many issues using the Direct Query option. This is caused me to then recreate everything using imports. 
I would say, unless you are using very basic measures and little transformation, Direct Query isn't always the most useful. This includes having issues where, dashboards built off of semantic models (Direct Query) don't always refresh correctly as expected. 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.