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

Did you hear? There's a new SQL AI Developer certification (DP-800). Start preparing now and be one of the first to get certified. Register now

Reply
Anonymous
Not applicable

SQL Query CTE – Power BI Optimized version for Report Server

I create reports with live data (Direct Query) connect them to the Power BI Report Server, on many of my reports I use CTE’s in my query, Power BI lets me retrieve data into the Power Query Editor which looks great and next moment I click on ‘Close and Apply’ which is supposed to load the dataset on Power BI Desktop I get an error message.

 

Work-around using an Import query is not an option because reports need live data. I’ve observed this issue is on-going for some years now, needs a fix as soon as possible, as all the reports created are for the Report Server. 

 

Are there any suggestions to work with CTEs and Direct Query?

 

leonardsuares_0-1595011475105.png

The Query uses CTE’s with Direct Query

 

leonardsuares_1-1595011475134.png

data retrieved successfully into Power Query Editor,

 

leonardsuares_0-1595011540859.png

This is the error message I receive on the Power BI Desktop workspace. No further details to this message.

2 REPLIES 2
az38
Community Champion
Community Champion

@Anonymous 

why dont you create a view in your origin SQL DB?

 

I see there are a lot of issues with CTE in Direct Query mode, like

https://community.powerbi.com/t5/Desktop/Custom-query-with-CTE-not-supported-bug/td-p/41395

also, please, vote for idea here

https://ideas.powerbi.com/ideas/idea/?ideaid=c0f672db-981d-45f2-982d-36bbf39b16f6


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn
Anonymous
Not applicable

Microsoft does not allow the SCCM DB to be edited, 

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.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

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.