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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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