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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

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
Microsoft Employee
Microsoft Employee

[removed]

hohlick
Continued Contributor
Continued Contributor

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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.