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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
c_d_m
Regular Visitor

Amazon Athena connector with Direct Query not working when using value.nativequery

Hi,

i have a power bi model using direct query with an amazon athena connector when i use it as desktop the model works fine but when i publish it to power bi service i get the error: Unable to connect to the data source . I have similar reports that work fine the difference is that in this report i am using Value.NativeQuery with direct query. I have rerport with Value.NativeQuery but with import mode that work fine. As well i have rerports that use direct query but loads the whole table and they work okay but this one that has a mixture of direct query and value.nativequery is not working the error i get is Unable to connect to the data source.

the fx looks something like this for direct query and for the import mode (for import it works for direct query it doesnt):

= Value.NativeQuery(AmazonAthena.Databases("mydatabase", null){[Kind="Database"]}[Data], "SELECT #(lf) COUNT(ids) AS TEST,#(lf) COUNT(ids2) as TEST2#(lf)FROM ""myschema"".""mytable""#(lf)GROUP BY SUBSTRING(CAST(date AS VARCHAR),1,10)", null, [EnableFolding=true])

Thanks!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @c_d_m 

 

According to the following official documentation, Amazon Athena is probably not supported by Value.NativeQuery function as it is not listed in Supported data connectors. 

Query folding on native queries - Power Query | Microsoft Learn

vjingzhanmsft_0-1718591927802.png

 

With Import mode, it will load data into Power BI. When some operations are not supported by query folding, it loads data into Power BI then uses Power Query engine to deal with it. So you see it works fine with Import mode. However with DirectQuery, Power Query engine won't deal with it so it may fail. 

 

Best Regards,
Jing
If this post helps, please Accept it as Solution to help other members find it. Appreciate your Kudos!

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @c_d_m 

 

According to the following official documentation, Amazon Athena is probably not supported by Value.NativeQuery function as it is not listed in Supported data connectors. 

Query folding on native queries - Power Query | Microsoft Learn

vjingzhanmsft_0-1718591927802.png

 

With Import mode, it will load data into Power BI. When some operations are not supported by query folding, it loads data into Power BI then uses Power Query engine to deal with it. So you see it works fine with Import mode. However with DirectQuery, Power Query engine won't deal with it so it may fail. 

 

Best Regards,
Jing
If this post helps, please Accept it as Solution to help other members find it. Appreciate your Kudos!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

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.