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
Max_701
Helper II
Helper II

Incremental Refresh - Stored Procedure in SQL Server

Hi,

I am trying to find this information if we can use stored procedures & do an incremenatl refresh - I have found very conflicting views on the forum & would love to have a final answer on this.

I think in an ideal work something like below should work without any issue

let
    Source = Sql.Database("your_server", "your_database"),
    Data = Value.NativeQuery(
        Source,
        "EXEC your_stored_procedure @StartDate = @p1, @EndDate = @p2",
        [p1 = RangeStart, p2 = RangeEnd],
        [EnableFolding = true]
    )
in
    Data



Thanks!

1 ACCEPTED SOLUTION
v-kpoloju-msft
Community Support
Community Support

Hi @Max_701,
Thank you for reaching out to the Microsoft fabric community forum. Also, thanks to @GilbertQ, for his input on this thread.

I understand there is a lot of mixed information about using stored procedures with Incremental Refresh in Power BI, so go through the below them.

Incremental refresh depends on query folding Power Query must be able to push your RangeStart / RangeEnd filters down to SQL Server. Stored procedures are treated like a “black box,” so folding often does not work reliably, even when using Value.NativeQuery. If folding breaks, Power BI will load the entire dataset and filter locally, which removes the benefit of incremental refresh.

Recommendation is to use a parameterized SQL query or a view instead of a stored procedure for incremental refresh, as this guarantees folding and predictable refresh behaviour.

If you must use a stored procedure:

  • Make sure it accepts @StartDate and @EndDate and applies them in the WHERE clause.
  • Call it with Value.NativeQuery and [EnableFolding = true].
  • Test folding in Power Query (Right-click step → View Native Query).

Kindly refer to the below mentioned documentation links for more information:
Incremental refresh for semantic models in Power BI - Power BI | Microsoft Learn
Understanding query evaluation and query folding in Power Query - Power Query | Microsoft Learn
Value.NativeQuery - PowerQuery M | Microsoft Learn

Hope this helps clarify things and let me know what you find after giving these steps a try happy to help you investigate this further.

Thank you for using the Microsoft Community Forum.

View solution in original post

3 REPLIES 3
v-kpoloju-msft
Community Support
Community Support

Hi @Max_701,
Thank you for reaching out to the Microsoft fabric community forum. Also, thanks to @GilbertQ, for his input on this thread.

I understand there is a lot of mixed information about using stored procedures with Incremental Refresh in Power BI, so go through the below them.

Incremental refresh depends on query folding Power Query must be able to push your RangeStart / RangeEnd filters down to SQL Server. Stored procedures are treated like a “black box,” so folding often does not work reliably, even when using Value.NativeQuery. If folding breaks, Power BI will load the entire dataset and filter locally, which removes the benefit of incremental refresh.

Recommendation is to use a parameterized SQL query or a view instead of a stored procedure for incremental refresh, as this guarantees folding and predictable refresh behaviour.

If you must use a stored procedure:

  • Make sure it accepts @StartDate and @EndDate and applies them in the WHERE clause.
  • Call it with Value.NativeQuery and [EnableFolding = true].
  • Test folding in Power Query (Right-click step → View Native Query).

Kindly refer to the below mentioned documentation links for more information:
Incremental refresh for semantic models in Power BI - Power BI | Microsoft Learn
Understanding query evaluation and query folding in Power Query - Power Query | Microsoft Learn
Value.NativeQuery - PowerQuery M | Microsoft Learn

Hope this helps clarify things and let me know what you find after giving these steps a try happy to help you investigate this further.

Thank you for using the Microsoft Community Forum.

Thanks! 

GilbertQ
Super User
Super User

Hi @Max_701 

 

I'm not sure that this is 100 percent it can be done with a stored procedure, but you can certainly do this with the database view. That might be an alternative option.





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

Proud to be a Super User!







Power BI Blog

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 Kudoed Authors