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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Anonymous
Not applicable

Need help optimizing DAX with SUMX

Hey everyone, 

 

I have a issue where my report is really slow, I think due to my nested measure and my final measure im using which uses the DAX Function SUMX.

 

SAIDI_CIRCUIT_SUM = SUMX(VALUES(REF_CIRCUIT[NOTIFICATION_DESCRIPTION]),[SAIDI_CKT!])

 

My question is does anyone know a more optimized version of SUMX which will give me the same result but faster. These are the amount of measures I needed to arrive at my SAIDI_CIRCUIT_SUM. Any help would be useful. 

 

What im doing is taking the first value from the from date on the slicer, taking the first value from the to date on the slicer and summing together then dividing it by 2 (As seen from measure CKTAVGMETERCNT). After that i take customer mins/ CKTAVGMETERCNT as seen with measure SAIDI_CKT! After i make it relevant only to the notification description with the measure SAIDI_CIRCUIT_SUM. 

 

CKT_FROM_DATE_FROM_SLICER = CALCULATE(MIN(DIM_DATE_CKT[DATE]),ALLSELECTED(DIM_DATE_CKT[DATE]))
 
CKTSumFromCount = CALCULATE(MIN(CV_SAP_METERCOUNT_CIRCUIT[READVALUE_FROM]), FILTER(DIM_DATE_CKT,DIM_DATE_CKT[DATE] = [CKT_FROM_DATE_FROM_SLICER]))
 
CKT_TO_DATE_FROM_SLICER = CALCULATE(MAX(DIM_DATE_CKT[DATE]),ALLSELECTED(DIM_DATE_CKT[DATE]))
 
CKTSumToCount = CALCULATE(MAX(CV_SAP_METERCOUNT_CIRCUIT[READVALUE_TO]), FILTER(DIM_DATE_CKT,DIM_DATE_CKT[DATE] = [CKT_TO_DATE_FROM_SLICER]))
 
CKT_First_Value_From_Date = CALCULATE([CKTSumFromCount],FIRSTNONBLANK(DIM_DATE_CKT[DATE], [CKTSumFromCount]))
 
CKT_Last_Value_To_Date = CALCULATE([CKTSumToCount],LASTNONBLANK(DIM_DATE_CKT[DATE], [CKTSumToCount]))
 
 
CKTMeterCount = IF(COUNT(CV_SAP_METERCOUNT_CIRCUIT[READVALUE_FROM]) = 1, 2, 2)
 
CKTAVGMETERCNT = DIVIDE([CKT_First_Value_From_Date] + [CKT_Last_Value_To_Date], [CKTMeterCount])
 
SAIDI_CKT! = IFERROR(sum(ZPM_O01_PM_OUTAGE_SUMMARY[CUSTOMER_MINUTES_FOR_OUTAGE_SUMMARY])/[CKTAVGMETERCNT],BLANK())
 
SAIDI_CIRCUIT_SUM = SUMX(VALUES(REF_CIRCUIT[NOTIFICATION_DESCRIPTION]),[SAIDI_CKT!])
 
 
1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

@Anonymous  - I'm with @parry2k DAX performance issues are notoriously difficult to troubleshoot. See my blog article series here:

https://community.powerbi.com/t5/Community-Blog/Performance-Tuning-DAX-Part-1/ba-p/976275

 

I would say if you don't really need that VALUES statement, ditch it. A lot of people use that function when they don't need to and it costs them performance.



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!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

3 REPLIES 3
Greg_Deckler
Super User
Super User

@Anonymous  - I'm with @parry2k DAX performance issues are notoriously difficult to troubleshoot. See my blog article series here:

https://community.powerbi.com/t5/Community-Blog/Performance-Tuning-DAX-Part-1/ba-p/976275

 

I would say if you don't really need that VALUES statement, ditch it. A lot of people use that function when they don't need to and it costs them performance.



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!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

@parry2k  @Greg_Deckler 

 

Thanks for feedback, I will try to explain more details when I post in the future. Actually, my problem is solved, teamates and I will just move these measure in the backend in the calculated tables itself - thanks!

parry2k
Super User
Super User

@Anonymous wow there is a lot more going on, in my opinion it will be easier if you put together sample data and what each measure is doing and what is the end goal, otherwise it is very hard to do reverse engineering



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.