Showing results for 
Search instead for 
Did you mean: 
Helper II
Helper II

Need help to understand why query plan change


I'm really need your help. I have spent alot of hours trying to get the same query plan for this.
I am using a slicer in Power BI to select the metric I want to analyze.
But the query plan will totaly change. It will generate a full table scan on one realy big table.
In the normal case I use the switch statement but to minimize to


Super User III
Super User III

I don't understand how your last comment is related to your original issue.


Have you considered inlining the measure code?

Helper II
Helper II

The reason for I'm digging in to this is the performance.
When I'm using [# of rows with Police dispatched by] in a visual direct, the response is under 1 second.
If I replace it with [Metric to show] the response is ~15 seconds.
I thought it was almost the same, just a simple check before returning the same metric.

Metric to show =
[Selected Metric Name],
"# of rows with Undefined",[# of rows with Undefined],
"# of rows with Incident Header]",[# of rows with Incident Header],
"# of rows with Police dispatched by",[# of rows with Police dispatched by],


Super User III
Super User III

in your case you don't need to use selectedvalue since you are already in the filter context and are not doing any context transition in your measure.


You use nested measures, however.  If you are concerned about performance then you will want to rewrite this to avoid calling one measure from another. In such a scenario it is better to be explicit and inline all the code.

Helpful resources

PBI User Groups

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

March Update

Check it Out!

Click here to read more about the March 2021 Updates!


The largest Power BI virtual conference

100+ sessions, 100+ speakers, Product managers, MVPs, and experts. All about Power BI. Attend online or watch the recordings.


Experience what’s next for Power BI

See the latest Power BI innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Top Solution Authors
Top Kudoed Authors