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

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

Reply
ShenWick
Regular Visitor

Poor performance in dax

I have created this dax, which leads to poor performance in the report

CALCULATE( [Total Overdue Balance],
FILTER( Distinct(FACT_CUSTOMER_INVOICE,
COUNTROWS(
FILTER('Age Groups',
[Over Due Days]>='Age Groups'[Start Day] &&
[Over Due Days]<='Age Groups'[End Day]))>0))

Is there an alternative dax to optimize the performance

2 REPLIES 2
Sahir_Maharaj
Super User
Super User

 

One possible optimization could be to use the SUMX function instead of the CALCULATE and FILTER functions:

SUMX(
FILTER(
'FACT_CUSTOMER_INVOICE',
COUNTROWS(
FILTER(
'Age Groups',
[Over Due Days] >= 'Age Groups'[Start Day] &&
[Over Due Days] <= 'Age Groups'[End Day]
)
) > 0
),
[Total Overdue Balance]
)

 

Another possible optimization could be to precalculate the result of the inner COUNTROWS function using a calculated column in the 'FACT_CUSTOMER_INVOICE' table, and then use that column in the DAX formula. This can reduce the computational overhead of the DAX formula at runtime.

Overdue Age Group Count =
COUNTROWS(
FILTER(
'Age Groups',
[Over Due Days] >= 'Age Groups'[Start Day] &&
[Over Due Days] <= 'Age Groups'[End Day]
)
)
SUMX(
FILTER(
'FACT_CUSTOMER_INVOICE',
'FACT_CUSTOMER_INVOICE'[Overdue Age Group Count] > 0
),
[Total Overdue Balance]
)

Let me know if you might need further assistance.

 


Did I answer your question? Mark my post as a solution, this will help others!

If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂

Kind Regards,
Sahir Maharaj
Data Scientist | Data Engineer | Data Analyst | AI Engineer
P.S. Want me to build your Power BI solution? (Yes, its FREE!)
➤ Lets connect on LinkedIn: Join my network of 15K+ professionals
➤ Join my free newsletter: Data Driven: From 0 to 100
➤ Website: https://sahirmaharaj.com
➤ About: https://sahirmaharaj.com/about.html
➤ Email: sahir@sahirmaharaj.com
➤ Want me to build your Power BI solution? Lets chat about how I can assist!
➤ Join my Medium community of 30K readers! Sharing my knowledge about data science and artificial intelligence
➤ Explore my latest project (350K+ views): Wordlit.net
➤ 100+ FREE Power BI Themes: Download Now
LinkedIn Top Voice in Artificial Intelligence, Data Science and Machine Learning

Hi @Sahir_Maharaj 
Your suggestions helped me to improve the performance, is there anything else that I can do further improve the performance?

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!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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.

Top Solution Authors
Top Kudoed Authors