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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
abhi9255
Helper II
Helper II

How to set command timeout option

My query is taking more time to refresh and when i refresh im getting command timeout error .

So i need to set command timeout option in Power BI desktop but it is disabled at the moment how to enable it??

1 ACCEPTED SOLUTION

Hi @abhi9255,

 

For SQL database, we can change the command timeout in Advanced options of  Data source settings directly.

 

ser.png

 

And here is the M code for your reference.

 

 

 

let
    Source = Sql.Databases("Servername", [CommandTimeout=#duration(0, 0, 35, 0)]),
    TestGatewayDocs = Source{[Name="databasename"]}[Data],
    dbo_Product3 = databasename{[Schema="dbo",Item="Product3"]}[Data]
in
    dbo_Product3

 

Regards,

Frank

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

View solution in original post

10 REPLIES 10
WillBeeSEA
Helper II
Helper II

I am using Dataverse and whenever I try to load (just two tables).

The data displays correctly in the Power Query Editor, but when I try to Close & Apply, it times out.

(My connection speed seems to be fine; 800+Mbps down, ~100Mbps up.)

 

Finding this discussion thread, I tried taking the CommandTimeout expression in the SQL solution:

,[CommandTimeout=#duration(0,0,35,0)]),

and adding it to my line, but it did not work:

WillBeeSEA_4-1734106832139.png

I stayed with the same 35-minute setting (did not want to fiddle with days, hours or seconds at this point),

but I received an error that CommandTimeout is not valid.

 

WillBeeSEA_6-1734109694481.png

Anything you can tell me would be helpful.    

Thank you.

v-frfei-msft
Community Support
Community Support

Hi @abhi9255,

 

What is your data source? I take a Excel data source as an example. In power bi desktop, firstly, go to the query editor, then you can edit your M code in Advanced Editor to set command timeout. See below image.

 

22.png

 

Here is the M code for your reference.

 

let
    Source = Excel.Workbook(File.Contents("filepath"), null, true,[timeout=#duration(0,0,30,0)]),
    Sheet1_Sheet = Source{[Item="Sheet1",Kind="Sheet"]}[Data],
    #"Promoted Headers" = Table.PromoteHeaders(Sheet1_Sheet, [PromoteAllScalars=true]),
    #"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"id", Int64.Type}})
in
    #"Changed Type"

 

For the parameter, the values represent Days, Hours, Minutes, Seconds. So, this setting represents a timeout of 30 minutes.

 

Regards,

Frank

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

I am using SQL Server Database as my source

Hi @abhi9255,

 

For SQL database, we can change the command timeout in Advanced options of  Data source settings directly.

 

ser.png

 

And here is the M code for your reference.

 

 

 

let
    Source = Sql.Databases("Servername", [CommandTimeout=#duration(0, 0, 35, 0)]),
    TestGatewayDocs = Source{[Name="databasename"]}[Data],
    dbo_Product3 = databasename{[Schema="dbo",Item="Product3"]}[Data]
in
    dbo_Product3

 

Regards,

Frank

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.
Anonymous
Not applicable

This does not necessarily help! We are running queries against an MSSQL DB and no matter where these values are set, the flows can fail after around 15 minutes due to timeout issues. You may need to contact the DB or Gateway admin to adjust the settings on their side.

 

Anonymous
Not applicable

I have many queries in the power i report, and i have also set up command timeout, But still when i try to refresh it fails with MSSql timeout error for one particular table.

 

Also how do you decide how much  Command timeout should be ?

asazure://westus.asazure.windows.net/ucmbusinessanalyticscube

 

My source is the above from analysis services. How do I change the timeout code there?

Anonymous
Not applicable

Hi, what if Tabular is the source?

Where you can change timeout for PowerBI?

Anonymous
Not applicable


Hi, @v-frfei-msft 

I keep getting scheduled refresh fails due to
Before the data import for (Data Source Name) finished, its data source timed out.

Why is there no option like this for PBI desktop for other sources like excel?

Hi @abhi9255,

 

Does that make sense, If so, kindly mark my answer as a solution to close the case please.

 

Regards,

Frank

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.