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
pratafran
Helper III
Helper III

omit backbround refresh if database error

Hello,

 

I have a Power BI on premise with around 20 different datasources in import mode and background refresh every 30 mins.

 

I'm adding a new connection to my model from an SQL server with an addtional table

 

My Power Query start with:

let
Source = Sql.Database("SERVER", "database", [Query="EXEC view1"])

 

Is any way of avoid the hole background refresh to stop if for any reason this connection is not available and fails?. Is it possible to add like an "IF ERROR" to the code, to omit refreshing this connection and continue with the others in case of unavailability of the server?

 

Thanks

1 ACCEPTED SOLUTION
lbendlin
Super User
Super User

Familiarize yourself with the try ... otherwise ...  pattern in Power Query

View solution in original post

6 REPLIES 6
Anonymous
Not applicable

Hi @pratafran ,

 

You can manually stop data refresh.

When you open Query Editor in power bi desktop, select the table that you do not want to refresh, right click it and disable Include in report refresh (it is active by default), close and apply Query Editor and the table will not refresh when the report is refreshed.

vstephenmsft_1-1646722095565.png

 

 

Best Regards,

Stephen Tao

 

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

Thank you,

 

If I exclude the table from report refresh, It will never refresh. What I'm looking for is to add a kind of conditional to that function. IF the database returns error when refreshing, omit the refresh, otherwise, refresh the content of that connection.

The problem arises with the inestability of a particular connection that I want to avoid stopping the refresh of the whole BI since it is only a dictionary that if it doesn't update, it is not a big issue.

Have you considered my suggestion to use try ... otherwise ... ?

I'm sorry, I hadn't understand your suggestion. I will try that option!

lbendlin
Super User
Super User

Familiarize yourself with the try ... otherwise ...  pattern in Power Query

Thank you very much for your suggestion!, that allowed me to refine my research in google and find a solution.

Below a link to a video which explains with an example, exactly what I was looking for.. the solution was with the "Try ... otherwise ..." statement

 

On minute 6:50 the example for my case:

https://youtu.be/V4jQ34ujJ9g

 

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