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
joshcomputer1
Helper V
Helper V

Query Optimization by using previous query as source

I was curious if I am sourcing the same table for two different queries, should I reference the first query as my source for the second query? It is pointing to the same dataset.  Does this speed up the overall query (refresh of data)?  I have some tables that I source multiple times because the etl steps are different, but I am listing the source as the file table and not the previous query.  Will someone will experience with this chime in?

1 ACCEPTED SOLUTION
v-juanli-msft
Community Support
Community Support

Hi @joshcomputer1

If i don't misunderstand you, reference the first query as my source for the other queries could improve the query performance.

 

You could refer to this article to get tips get Query Optimization.

https://docs.microsoft.com/en-us/power-bi/desktop-tips-and-tricks-for-creating-reports#reference-que...

 

if you have a base query A, and then two new queries B and C referencing A. A isn't loaded to report but B and C are.( uncheck "enable load" for queryA.

When you hit the Apply button, B and C will simultaneously start loading to report.

 

PowerQuery evaluations keeps a cache of data seen by evaluations on disk.

So if you are within the same cache session and pulled on A multiple times, you will essentially only pay for it the first time.

This cache will ONLY apply to raw data coming from the data source, any additional transformations will need to be performed on top of it.

Finally, since when you load queries to report, you always want the latest data. So each loading session is essentially a new cache session.

 

In a summary, You will only need to pay for the data coming from data source A ONCE per loading all of the queries. 

However, you will pay for the transformations on top of A N times where N = the number of queries been loaded.

 

 

Best Regards

Maggie

 

View solution in original post

1 REPLY 1
v-juanli-msft
Community Support
Community Support

Hi @joshcomputer1

If i don't misunderstand you, reference the first query as my source for the other queries could improve the query performance.

 

You could refer to this article to get tips get Query Optimization.

https://docs.microsoft.com/en-us/power-bi/desktop-tips-and-tricks-for-creating-reports#reference-que...

 

if you have a base query A, and then two new queries B and C referencing A. A isn't loaded to report but B and C are.( uncheck "enable load" for queryA.

When you hit the Apply button, B and C will simultaneously start loading to report.

 

PowerQuery evaluations keeps a cache of data seen by evaluations on disk.

So if you are within the same cache session and pulled on A multiple times, you will essentially only pay for it the first time.

This cache will ONLY apply to raw data coming from the data source, any additional transformations will need to be performed on top of it.

Finally, since when you load queries to report, you always want the latest data. So each loading session is essentially a new cache session.

 

In a summary, You will only need to pay for the data coming from data source A ONCE per loading all of the queries. 

However, you will pay for the transformations on top of A N times where N = the number of queries been loaded.

 

 

Best Regards

Maggie

 

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.

Top Solution Authors