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
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
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 Fabric 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.