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

Try your skills in the Power BI Dataviz World Championship! Round one ends June 26. Join now

Reply

Unable to Connect Power BI with SQL Query

I am trying to connect Power BI with SQL query with Direct import query wherein it works fine in SQL and power editor but after proceeding with "Load" the below error occurs. I am looking for the solution for past 2 weeks. Can anyone assist me.

 

Error : 
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 ')'.

1 REPLY 1
themistoklis
Community Champion
Community Champion

Hello @Revathi_Kannan ,

 

This is a MS SQL Server error message.

 

Start the WITh SQL statement (Common Table Expression) by adding a semicolon before it:

like below:

;WITH

Helpful resources

Announcements
Fabric Data Days is here Carousel

Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

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.