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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
ms527
Regular Visitor

Cannot change Datasource when using Native Query to call Stored procedure

I have data source that I'm Calling a Stored Procedure to use Incremental Refresh in Power BI. Now I cannot change datasource as it is greyed out on account of using Native Query. i.e.

 

let
Source = Sql.Database("SERVERNAME", "DatabaseName"),
NativeQuery = Value.NativeQuery( Source, "EXEC sp_PBI_load_sales @StartDate, @EndDate", [StartDate = RangeStart, EndDate = RangeEnd], [EnableFolding=true] )
in
NativeQuery

 

This also breaks changing or creating datasource rule in the deployment pipeline.

1 REPLY 1
Anonymous
Not applicable

Hi @ms527 

 

Based on the details you provided, it appears that you are encountering limitations related to using native queries and stored procedures with Power BI's incremental refresh and data source management features.

 

Power BI's incremental refresh feature does not support using stored procedures directly, as described in the following link.

 

Query folding guidance in Power BI Desktop - Power BI | Microsoft Learn

 

Incremental refresh requires the ability to apply filters directly on the query to determine what data has changed, which is not possible with stored procedures because they encapsulate SQL queries.

 

Regarding the issue of the datasource option being greyed out, this is likely due to the use of a native query.

 

When you use a native query (), Power BI treats this as a custom SQL statement and limits certain functionalities, including changing the datasource through the UI, as it cannot guarantee that the new datasource will support the custom SQL without errors.

 

You can try the following to resolve the issue:

 

Modify the Approach for Incremental Refresh: Instead of using a stored procedure, consider implementing the logic directly in Power Query M language or using a view in your database that can be parameterized within Power BI.

 

This allows Power BI to manage the query folding and apply the necessary filters for incremental refresh.

 

Changing the Datasource: To change the datasource, you might need to manually edit the Power Query M code to replace the server and database names.

 

Regards,

Nono Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors