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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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?
➤ Lets connect on LinkedIn: Join my network of 15K+ professionals
➤ Join my free newsletter: Data Driven: From 0 to 100
➤ Website: https://sahirmaharaj.com
➤ 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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

AugPowerBI_Carousel

Power BI Monthly Update - August 2024

Check out the August 2024 Power BI update to learn about new features.

August Carousel

Fabric Community Update - August 2024

Find out what's new and trending in the Fabric Community.