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
SBIM
Helper I
Helper I

Enabling Query Folding on Native Query

I am trying to setup an incremental refresh but I am having trouble with the query folding. My connection is via an ODBC driver and I am connecting to an AS400 system. I can run queries against it fine, but I am getting the warning the M query may not support folding. I checked on the very first step and View Native Query was greyed out which is suppose to mean it does not support folding. So I have tried to follow some guides on how to enable it via a custom step in the Power Query Editor

 

e.g. 

= Value.NativeQuery(Source, "SELECT DISTINCT
OH.OHOTYP,
OHORDD,
OHENTD,
OH.""OHORD#"" AS ""OHORD#"",
OH.OHMTTM,
OH.OHCRQM,
OHREQD,
OH.OHINIT,
OH.OHDTMT,
OH.OHMTTM AS OHMTTM_1,
OH.OHMUSR,
OHP.OHCORD
FROM
IASP1.FRNDTA031.OH OH,
IASP1.FRNDTA031.O6 O6,
IASP1.FRNDTA031.CM1 CM1,
IASP1.FRNDTA031.O4 O4,
IASP1.FRNDTA031.OHP OHP
WHERE
OH.""OHORD#"" = O6.""O6ORD#""
AND OH.OHBTKY = CM1.C1STKY
AND OH.""OHORD#"" = O4.""O4ORD#""
AND OH.OHDRC = OHP.OHDRC
AND OH.""OHORD#"" = OHP.""OHORD#""
AND OH.OHLSUF = OHP.OHLSUF
AND (( OH.OHBTKY <> '007279'
AND OH.""OHORD#"" > 0))
AND OH.OHOTYP = 'SI'
AND OHP.OHCORD < 0
ORDER BY
5 DESC", null, [EnableFolding = true])

 

But I am getting the error Native queries are not supported by this value. Details: [Table]

 

SBIM_0-1673444173675.png

 

Am I doing something wrong or is query folding not going to be an option here?

1 REPLY 1
edhans
Super User
Super User

Initially Value.NativeQuery only worked with PostGRE SQL, then SQL Server as well. More are being added - cannot find a good list - but pretty sure AS/400 via ODBC is not yet on that list unfortunately.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

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.