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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
PaulDBrown
Community Champion
Community Champion

A more effective solution (DAX)?: how to avoid using 2x SUMX

Hi everyone,

 

I'm struggling with DAX in trying to achieve a more elegant/performance-effective solution. 

 

The objective (outcome I'm looking for):

"what is the projected sales based on the performance of estimates over sales?" Which in simple terms means I'm trying to calculate a number for sales for Items for which there are no "estimates" based on how  items which do have  "estimates" vary against their  sales (if that makes sense...).

 The problem I'm encountering is that in order to get the final result, including totals, I'm having to use two measures with SUMX, which doesn't seem very performance-effective.

 

So is there a more elegant solution?

 

Here is a dummy table:

 

MATRIX SALES WN ESTFINAL.png

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

And here is the sample PBIX file:

 

 

Projected Sales

 

Thank you in advance for your kind help!

 

Regards,

Paul.





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






1 REPLY 1
v-shex-msft
Community Support
Community Support

Hi @PaulDBrown,

 

I'm not recommend you to use complex measure for in sumx or other summary function which contains if statement.(calculate count will multiplied = current row count * measure calculation count)

 

If measure nested multiple times, the calculation will increase to very huge amount. It will obviously cut down calculate performance.

 

I'd like to suggest you take a look at below blogs which told about how to increase performance when you nested use measures.

 

 

Reference link:

Optimizing DAX expressions involving multiple measures

Order of Evaluation in CALCULATE Parameters

 

BTW, you can also considered to sue summarize function to create variable tables to stored previous result, then calculate on summarised table. It will cut down calculation amount.

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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