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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
TimHoare
Frequent Visitor

Direct query limitations with the Snowflake connector

I have a report that connects to a Snowflake database via direct query, and a measure that calculates the median of a column. Because MEDIAN is a function that is supported in Snowflake, ideally the query would be folded back to the database, but I can see that Power BI is instead reading all the data back, then calculating the median locally. Because of this, it is a lot slower than it otherwise would be if it folded the query, and if there are more than one million rows to calculate the median from, it doesn't work at all. The documentation here mentions that "usually the median aggregate isn't supported by the underlying source", but does this mean it will not fold the query for any direct query sources, even though it supported by Snowflake in this case?

2 REPLIES 2
jeffshieldsdev
Solution Sage
Solution Sage

Update the Snowflake query to use native SQL, something like:

let
    Source = Value.NativeQuery(
        Snowflake.Databases("server", "warehouse", [Role="role"]){[Name="database"]}[Data],
        "
sql
        ",
        null,
        [EnableFolding=true]
    )
in
    Source

and use MEDIAN() function that way. 

lbendlin
Super User
Super User

It may be supported by Snowflake, but that doesn't mean it is included in Power Query's knowledge how to translate M code into Snowflake code.  If this is important to you please consider voting for an existing idea or raising a new one at https://ideas.fabric.microsoft.com/?forum=2d80fd4a-16cb-4189-896b-e0dac5e08b41

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 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.

Top Solution Authors