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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
datapal04
Frequent Visitor

Query Folding with Complex Native Queries

Hello,

I have several native queries I'm using to get data into Power BI from SQL Server (using SQL statements - advanced option). Some of my native queries are complex - some include joins or performing counts. I'm unable to achieve query folding (at least according to this method here) - I get an error saying the query cannot be folded. 

I would like to know if queries as complex as this can achieve query folding? I'm finding the only way to do this effectively is to have a view created and having a "select *" to get that data. Ultimately, I am trying to achieve incremental refresh. Any advice would be great!

3 REPLIES 3
ppm1
Solution Sage
Solution Sage

If you can't get folding to occur with Value.NativeQuery, you can always create datetime parameters called RangeStart and RangeEnd and concatenate those into your SQL statement WHERE clause too. This video shows an example - (1) Natives Queries or ODBC with Incremental Refresh in Power BI - YouTube

 

Pat

Microsoft Employee

Hi @ppm1 , I tried following the video you shared by creating a dataflow but I run into the error below while trying to authenticate for it. My database is on-prem... could this be a reason why I am unable to achieve query folding for incremental refresh?Capture2.JPG

Can you get it to work in a query in Power BI Desktop? Is the issue only when you try it via Dataflow? If so, do you have a gateway set up?

 

Pat

Microsoft Employee

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors