Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
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?
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
Sourceand use MEDIAN() function that way.
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
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 38 | |
| 38 | |
| 36 | |
| 28 | |
| 28 |
| User | Count |
|---|---|
| 124 | |
| 88 | |
| 74 | |
| 66 | |
| 65 |