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
Anonymous
Not applicable

Performance improvement with Summarize

Hi All,

 

I have below DAX which is used to calculate differect result but by using Summarize function , performance is affecting badly. Please help me to write below DAX in optimized way so that these DAX works fastly.

 

All = COUNTX(ADDCOLUMNS(SUMMARIZE(' Sales',' Sales'[Material],'Geography'[Country]),"counts",CALCULATE(DISTINCTCOUNT('Sales'[Material]))),[counts])

 

#2  = SUMX(ADDCOLUMNS(SUMMARIZE('Sales','Geography'[Country], 'Sales'[Material]),"fulldata", CALCULATE([All], FILTER(ADDCOLUMNS(SUMMARIZE('Sales','Sales'[Code],' Sales'[Material],'Geography'[Country]), "weightsum", CALCULATE(SUM('Sales'[Weight]))), [weightsum]>0))),[fulldata])


#3 = VAR Blanks = CALCULATETABLE(VALUES('Sales'[Material]),ALL('Sales'),ISBLANK('Sales'[Weight]),'Sales'[Weight]=0)
RETURN
CALCULATE([#2],KEEPFILTERS (NOT 'Sales'[Material] IN (Blanks)))

 

 

Thanks in Advance !

Vinay

3 REPLIES 3
v-eachen-msft
Community Support
Community Support

Hi @Anonymous ,

 

Instead of using the SUMMARIZE() function in this manner, you could use the SUMMARIZECOLUMNS() DAX function. The SUMMARIZECOLUMNS() function is newer and better optimized.

 

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.
Anonymous
Not applicable

@v-eachen-msft 

 

Summarizecolumn cannot be used as a Measure right? it can only be used to create a Table, here in my situation i'm Summarize as a Measure. Please correct me if i'm wrong

 

If its possible to have a Measure with Summarizecolumn, can you please provide one example ?

 

Regards,

Vinay

jthomson
Solution Sage
Solution Sage

Might be an idea to give us some sample data, and what you're actually trying to get the measures to do

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.