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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

DAX Optimization help request

Hi Everyone, 

 

I have a query that take timeout error, can you please help me to optimise the dax query?

 

Query is below that;

 

DEFINE
VAR CA =
SUMMARIZE (
'FACT_SALES',
'FACT_SALES'[CLIENT_ID],
"client_xx",
IF (
CALCULATE (
SUM ( 'FACT_SALES'[MONTANTNET] ),
USERELATIONSHIP ( 'DIM Representant'[REPRESENTANT_ID], 'FACT_SALES'[REPRESENTANT_ID] )
) > 0.00001,
1,
0
))
RETURN
SUMX ( CA, [client_xx] )

 

Looking forward to your answers

 

Regards,

 

4 REPLIES 4
123abc
Community Champion
Community Champion

It seems like you are trying to create a calculated column in DAX using the SUMX and SUMMARIZE functions. Without knowing the exact details of your data model and the specific optimization needs, I can provide some general suggestions to improve the performance of your DAX query.

  1. Avoid using IF inside CALCULATE: You are using an IF statement inside CALCULATE, which might lead to performance issues. Try to rewrite your DAX using FILTER or other relevant functions to avoid the nested IF.

DEFINE
VAR CA =
SUMMARIZE (
'FACT_SALES',
'FACT_SALES'[CLIENT_ID],
"client_xx",
CALCULATE (
SUM ( 'FACT_SALES'[MONTANTNET] ),
USERELATIONSHIP ( 'DIM Representant'[REPRESENTANT_ID], 'FACT_SALES'[REPRESENTANT_ID] )
) > 0.00001
)
RETURN
SUMX ( CA, [client_xx] )

 

Avoid using SUMMARIZE inside SUMX: The use of SUMMARIZE inside SUMX might not be necessary. Instead, try to use the underlying table directly in SUMX.

 

DEFINE
VAR CA =
CALCULATETABLE (
VALUES('FACT_SALES'[CLIENT_ID]),
'FACT_SALES'[MONTANTNET] > 0.00001,
USERELATIONSHIP ( 'DIM Representant'[REPRESENTANT_ID], 'FACT_SALES'[REPRESENTANT_ID] )
)
RETURN
SUMX ( CA, [client_xx] )

 

  1. Check relationships and indexes: Ensure that your relationships are correctly set up in the data model. Also, check if there are indexes on the relevant columns for better query performance.

  2. Use simpler expressions if possible: If your measure is still slow, consider simplifying the logic or breaking down the calculation into smaller steps to identify the bottleneck.

Remember that DAX performance optimization often depends on the specific characteristics of your data and data model, so it's essential to test different approaches and monitor the performance impact.

123abc
Community Champion
Community Champion

It seems like you are trying to create a calculated column in DAX using the SUMX and SUMMARIZE functions. Without knowing the exact details of your data model and the specific optimization needs, I can provide some general suggestions to improve the performance of your DAX query.

  1. Avoid using IF inside CALCULATE: You are using an IF statement inside CALCULATE, which might lead to performance issues. Try to rewrite your DAX using FILTER or other relevant functions to avoid the nested IF.

DEFINE
VAR CA =
SUMMARIZE (
'FACT_SALES',
'FACT_SALES'[CLIENT_ID],
"client_xx",
CALCULATE (
SUM ( 'FACT_SALES'[MONTANTNET] ),
USERELATIONSHIP ( 'DIM Representant'[REPRESENTANT_ID], 'FACT_SALES'[REPRESENTANT_ID] )
) > 0.00001
)
RETURN
SUMX ( CA, [client_xx] )

 

Avoid using SUMMARIZE inside SUMX: The use of SUMMARIZE inside SUMX might not be necessary. Instead, try to use the underlying table directly in SUMX.

 

DEFINE
VAR CA =
CALCULATETABLE (
VALUES('FACT_SALES'[CLIENT_ID]),
'FACT_SALES'[MONTANTNET] > 0.00001,
USERELATIONSHIP ( 'DIM Representant'[REPRESENTANT_ID], 'FACT_SALES'[REPRESENTANT_ID] )
)
RETURN
SUMX ( CA, [client_xx] )

 

  1. Check relationships and indexes: Ensure that your relationships are correctly set up in the data model. Also, check if there are indexes on the relevant columns for better query performance.

  2. Use simpler expressions if possible: If your measure is still slow, consider simplifying the logic or breaking down the calculation into smaller steps to identify the bottleneck.

Remember that DAX performance optimization often depends on the specific characteristics of your data and data model, so it's essential to test different approaches and monitor the performance impact.

Dangar332
Super User
Super User

hi, @Anonymous 

 

DEFINE
VAR CA =
addcolumn(
all('FACT_SALES'[CLIENT_ID]),
"client_xx",
IF (
  CALCULATE (
     SUM ( 'FACT_SALES'[MONTANTNET] ),
     USERELATIONSHIP ( 'DIM Representant'[REPRESENTANT_ID], 'FACT_SALES'[REPRESENTANT_ID] )
  ) > 0.00001,
1,
0
))
RETURN
SUMX ( CA, [client_xx] )

 

lbendlin
Super User
Super User

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.