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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register 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
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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