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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Anonymous
Not applicable

Refresh individual power queries instead of all of them at once

Hi,

Is there a way to refresh one Power Query instead of them all loading? At the minute I have one query that can't be refreshed because we haven't completed a CI yet this month and so there's no data there to show/load, (this is fine) but it's cancelling all the other queries from refreshing

 

Thanks


Charlotte

 

1 ACCEPTED SOLUTION

Hi @Anonymous ,

 

I think, in this instance, you would set up an alternate source that will refresh instead of your main source if there is an error with it such as you describe.

You would implement this in the M code something like the following, where you substitute in a created table that will refresh in the event of main source error:

let
    //This is the original code generated by Power Query
    Source = 
      Csv.Document(File.Contents("C:\Users\Chris\Documents\SampleData.csv"),null,",",null,1252),
    #"First Row as Header" = Table.PromoteHeaders(Source),
    #"Changed Type" = Table.TransformColumnTypes(#"First Row as Header",
      {{"Month", type text}, {"Product", type text}, {"Sales", Int64.Type}}),
    //End of original code
    //Define the alternative table to return in case of error    
    AlternativeOutput=#table(type table [Month=text,Product=text,Sales=Int64.Type],
      {{"Error", "Error", 0}}),
    //Does the Source step return an error?
    TestForError= try Source,
    //If Source returns an error then return the alternative table output
    //else return the value of the #"Changed Type" step
    Output = if TestForError[HasError] then AlternativeOutput else #"Changed Type"
in
    Output

 

Credit for this goes to Chris Webb, and the full solution can be viewed on his blog here.

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




View solution in original post

6 REPLIES 6
Icey
Community Support
Community Support

Hi @Anonymous ,

 

Please let us know if the replies above are helpful.

 

If they are, please always accept the replies making sense as solution to your question so that people who may have the same question can get the solution directly.

 

If not, please give us more details.

 

 

Best Regards,

Icey

Tahreem24
Super User
Super User

@Anonymous ,

In POwer Query, You can just open your table --> Home --> Click on small down arrow on "Refresh Preview" --> Click on Refresh Preview instead of Refresh All.

OR

In PBI Desktop, Click on 3 dots on any table from Right most Field Pane, Click "Refresh Data".

 

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Please take a quick glance at newly created dashboards : Restaurant Management Dashboard , HR Analytics Report , Hotel Management Report, Sales Analysis Report , Fortune 500 Companies Analysis , Revenue Tracking Dashboard
BI_Jo
Resolver III
Resolver III

Hi Charlotte,

If you're refreshing the query in desktop you can go to the individual table/query name, click on the 3 dots and select 'Refresh data'.

Can use this instead of the Refresh button in the top menu.

Jo

Anonymous
Not applicable

Hi Jo, Thanks for this, the problem I then have is when I try to click apply and close in power query, it won't update it in PowerBi because one of queries can't load any data. Is there a way around this? I had thought that refreshing individually might do it

Hi @Anonymous ,

 

I think, in this instance, you would set up an alternate source that will refresh instead of your main source if there is an error with it such as you describe.

You would implement this in the M code something like the following, where you substitute in a created table that will refresh in the event of main source error:

let
    //This is the original code generated by Power Query
    Source = 
      Csv.Document(File.Contents("C:\Users\Chris\Documents\SampleData.csv"),null,",",null,1252),
    #"First Row as Header" = Table.PromoteHeaders(Source),
    #"Changed Type" = Table.TransformColumnTypes(#"First Row as Header",
      {{"Month", type text}, {"Product", type text}, {"Sales", Int64.Type}}),
    //End of original code
    //Define the alternative table to return in case of error    
    AlternativeOutput=#table(type table [Month=text,Product=text,Sales=Int64.Type],
      {{"Error", "Error", 0}}),
    //Does the Source step return an error?
    TestForError= try Source,
    //If Source returns an error then return the alternative table output
    //else return the value of the #"Changed Type" step
    Output = if TestForError[HasError] then AlternativeOutput else #"Changed Type"
in
    Output

 

Credit for this goes to Chris Webb, and the full solution can be viewed on his blog here.

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




Hi Charlotte,

 

I think you can update the individual query in the desktop window instead of in the query editor window.

 

Jo

Helpful resources

Announcements
July 2024 Power BI Update

Power BI Monthly Update - July 2024

Check out the July 2024 Power BI update to learn about new features.

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

Top Solution Authors