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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
mhmmd_srf
New Member

Not able to find Custom SQL option in Dataflow when source is databricks

Hi All,

 

I am trying to create a dataflow on top of databricks as data source. However, I am not able to find any option to write custom SQL. Though, it is there when I change my source to HANA or SQL Server.

Could you please help here.

Thanks,

Sarif

3 REPLIES 3
Poojara_D12
Super User
Super User

Hi @mhmmd_srf 

When creating a dataflow in Power BI using Databricks as the data source, you may notice that the option to write custom SQL queries is not available, unlike with traditional relational sources like SQL Server or SAP HANA. This limitation exists because the Databricks connector in Power BI dataflows currently does not support query folding or direct SQL input within the Power Query Online editor. Instead, it enforces a more GUI-based approach where you must use the standard table and column selection method followed by transformation steps using Power Query (M language).

This can be frustrating if you rely on complex SQL logic or want to optimize performance by pushing query logic down to Databricks. One workaround is to define your transformations as views or custom queries within Databricks itself, and then reference those views from Power BI dataflows. Another alternative is to use a Power BI Desktop file to connect to Databricks, write your custom SQL there, and then export the M script to use inside the dataflow (though this still won’t enable direct SQL execution, it helps preserve logic). Until Microsoft adds support for native SQL editing for Databricks in dataflows, these workarounds are the only viable approaches.

 

Did I answer your question? Mark my post as a solution, this will help others!
If my response(s) assisted you in any way, don't forget to drop me a "Kudos"

Kind Regards,
Poojara - Proud to be a Super User
Data Analyst | MSBI Developer | Power BI Consultant
Consider Subscribing my YouTube for Beginners/Advance Concepts: https://youtube.com/@biconcepts?si=04iw9SYI2HN80HKS
GilbertQ
Super User
Super User

Hi @mhmmd_srf 

 

It is possible to write a custom sequel query using data bricks. Here is an example below on how to achieve this. 

In the example below, you would need to replace the details with your databricks, plus the details and SQL code.

let
    Source = Databricks.Catalogs("adb-1234567890123456.7.azuredatabricks.net", "/sql/1.0/warehouses/abc123def456", [Catalog="samples", Schema="nyctaxi"]),
    Query = Value.NativeQuery(Source, "SELECT * FROM samples.nyctaxi.trips WHERE tpep_pickup_datetime >= DATEADD(day, -7, CURRENT_DATE)")
in
    Query

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!







Power BI Blog

So, I need to do this in Advanced Editor. No option while creating connection like we have if data source is SQL Server?

Thanks,

MS

Helpful resources

Announcements
May PBI 25 Carousel

Power BI Monthly Update - May 2025

Check out the May 2025 Power BI update to learn about new features.

May 2025 Monthly Update

Fabric Community Update - May 2025

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