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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Mainer04401
Helper III
Helper III

Optimized MAXX & SUMMARIZE Expression

I need to calculate the maximum sales by any account in a user-specified geography, excluding the account in the filter or in the row.  I have an expression that works but its very sluggish and I wonder if there's opportunity for optimization.

 

When I tried to use the regular MAX, it appeared limited to row values and would not return an aggregate max.  For example, it worked fine at the zip code level, but when I viewed by state, it was still returning the maximum value of an account's sales at the zip code level rather than returning the maximum aggregate sales by account in a state.

 

Here's what I am using now.  Any thoughts?

 

Maximum Sales of Any Account =
var _SelectedAccount = if(HASONEVALUE(StoreList[AccountNumber]),firstnonblank(StoreList[LAccountNumber],true),0)
return
maxx(summarize(Market,Market[AccountNumber],"Max Sales", calculate(sum(Market[Sales_Volume]),
filter(all(Market[AccountNumber]),Market[AccountNumber]<>_SelectedAccount))),[Max Sales])
1 REPLY 1
v-easonf-msft
Community Support
Community Support

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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