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

Efficiency of Queries

Dear all,

 

I am wondering?

 

If I have Table 1, Table 2 and Table 3, Query A, Query B and Query C.

 

Query A produces a scalar date value which is the Max of dates in Table 1.

 

Query B runs a Select Rows operation using the result of Query A to filter the range of dates returned from Table 2.

Query C runs a Select Rows operation using the result of Query A to filter the range of dates returned from Table 3.

 

Is Query A only calculated once and the value used in Query B and Query C, or is Query A calculated separately for both Query B and Query C.

 

If this is true what is the best way to do things so that I only need to calculated Query A once to be used by both Query B and Query C rather than having to calculate it multiple times.   

5 REPLIES 5
Eric_Zhang
Employee
Employee

[removed]

Hi @Eric_Zhang

Can you please explain this: 


If you'd like the Query1 run only once, then you can create it as a function.

Is turnung a query into an invoked function result prevents it from recalculating when other queries linked to it? Or it depends from data source?

How it could be referenced to this thread

Maxim Zelensky
excel-inside.pro

@hohlick @Anonymous

My bad, as the function in M is called manually in my case so I thought it persists as a constant and won't be re-evulated. I'm deleting that part in my reply to avoid missleading.

 

Thanks for that link, it is really really helpful.

Anonymous
Not applicable

Thank you very much. I will try that out as I update some of my data models. 

Anonymous
Not applicable

Dear all,

 

I am wondering?

 

If I have Table 1, Table 2 and Table 3, Query A, Query B and Query C.

 

Query A produces a scalar date value which is the Max of dates in Table 1.

 

Query B runs a Select Rows operation using the result of Query A to filter the range of dates returned from Table 2.

Query C runs a Select Rows operation using the result of Query A to filter the range of dates returned from Table 3.

 

Is Query A only calculated once and the value used in Query B and Query C, or is Query A calculated separately for both Query B and Query C.

 

If this is true what is the best way to do things so that I only need to calculated Query A once to be used by both Query B and Query C rather than having to calculate it multiple times.   

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.