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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Need help to understand why query plan change

Hi!

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


Picture1.pngPicture2.png

3 REPLIES 3
lbendlin
Super User
Super User

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

 

Have you considered inlining the measure code?

Anonymous
Not applicable

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 =
SWITCH(
[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],
BLANK()
)

 

lbendlin
Super User
Super User

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

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.