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

The FabCon + SQLCon recap series starts April 14th at 8am Pacific. If you’re tracking where AI is going inside Fabric, this first session is a can't miss. Register now

Reply
Anonymous
Not applicable

Optimize DAX - Filters

Hello everyone! How are you?

Taking advantage of the Spanish forum, I make the following related query to optimize query performance:

I have a measure that has a SWITCH with 10 IF (each with its condition) and a variable with a FILTER that is applied to the SWITCH CALCULATE:

VALUE=
VAR KPIS =
FILTER (
Table_1;
Table_1[ID_Account] = MAX ( Table_2[KPI_Account] )
)

VAR valor =
SWITCH (
Index;
1; IF (Condition);
2; IF (Condition);
3; IF (Condition);
4; IF (Condition);
5; IF (Condition);
6; IF (Condition);
7; IF (Condition);
8; IF (Condition);
9; IF (Condition);
10; IF (Condition);
FORMAT ( CALCULATE ( [Actual]; KPIS ); formato )
)
RETURN
valor

I'm trying to optimize the query, for this I wanted to start by the FILTER of the KPIS variable.

According to what I have been reading the ideal is to apply a KEEPFILTER ( FILTER ( ALL, in case in the filter we are using a single table, but in my case I am using two different tables.

Does anyone have any recommendations to optimize the FILTER part? Maybe adding a CROSSJOIN?

Thanks a lot!

Best regards!

2 REPLIES 2
Anonymous
Not applicable

Hi @Anonymous ,

In order to better understand your requirement, could you please provide some sample data and the results you want? Also please explain what are the condition and function of the formula which need to be optimized? Then we can provide you with appropriate suggestion or formula based on your scenario. Thank you.

Best Regards

Rena

Greg_Deckler
Community Champion
Community Champion

I do not see an obvious way to improve that filter. Perhaps more information would help. Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.