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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Direct query is excessively slow

Hi Mentors;

I am building a report and this needs immediate data; Hence I am using direct query over a table valued function as there are lots of logics need to be implemented. Now in the query, I have 3 slicers and 4 visuals and the reportis excessively slow. SOmehow this works in desktop, but in service or external application (where the report is embedded), its simply failing.

Consider that I need to have employee details; so I am using "SEELCT * FROM tvfEmpDtl()"

Is there a way that I can supply the parameter to the TVF life "SELEC * FROM tvfEmpDtl(2)" so that I can get the data of employeeID 2?

Please consider that I need to pass teh parameter 2 from another portal. I have tried to play with Power Query but still in vain.

Any helpp is much appriciated.

Regards,

Arup

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi Stephen,

Thanks for your reply. I have already gone through the link. However, this is not working in DirectQuery while published to Service. This is the main issue.

However, I am found a workaround. Initially I was using the "Table Valued Function" and THIS WAS THE CAUSE OF SLOWNWSS. Now I have inserted the data in a physical table and so far the performance is satisfactory.

So, my learning is not to use TVF unless this is the only solution.

Regards,

Arup

 

View solution in original post

7 REPLIES 7
v-stephen-msft
Community Support
Community Support

Hi @Anonymous ,

 

Please refer to Change the Source of Power BI Datasets Dynamically Using Power Query Parameters

 

 

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.

Anonymous
Not applicable

Hi Stephen,

Thanks for your reply. I have already gone through the link. However, this is not working in DirectQuery while published to Service. This is the main issue.

However, I am found a workaround. Initially I was using the "Table Valued Function" and THIS WAS THE CAUSE OF SLOWNWSS. Now I have inserted the data in a physical table and so far the performance is satisfactory.

So, my learning is not to use TVF unless this is the only solution.

Regards,

Arup

 

v-stephen-msft
Community Support
Community Support

Hi @Anonymous ,

 

You may want to konw about optimizing your data source, please kindly refer to

Optimization guide for Power BI

DirectQuery model guidance in Power BI Desktop

 

 

 

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.

Anonymous
Not applicable

Hi Stephen,

Thanks for your reply. However, already I have considered all these and still in dark. Since my report is based on a single table value function, is it the problem? I have not found anywhere that using TVF can degrade th performance, but this is happening here.

Can we send a parameter to table value function while using direct query?

Regards,

Arup

Anonymous
Not applicable

Hello Mentors,

Is there any solution for this or thisis NOT possible so far in PBI?

Regards,

Arup

amitchandak
Super User
Super User

@Anonymous , I have not tested this, but see if dynamic m query parameters, can help

https://docs.microsoft.com/en-us/power-bi/connect-data/desktop-dynamic-m-query-parameters

 

Another suggestion, think about mix mode, where few tables can be import mode.

Anonymous
Not applicable

Hi Amit,

Thanks for your reply. However, I am able to make the Direct query dynamic with parameters as below:

let
Source = Sql.Database("testdb.database.windows.net", "testDB", [Query="SELECT * FROM [risk].[fnCustomar_details]( " &Number.ToText(CustID) & ")"])
in
Source

This is working fine in PBI Desktop. However, after publishing, I am not able to see the Parameter section from Dataset->Settings->Parameters. Hence just confused how to send the customer ID as a parameter to the service.

Your help is pretty much appreciated.

Thanks,

Arup

 

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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