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.
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
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.
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
Might be an idea to give us some sample data, and what you're actually trying to get the measures to do
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
113 | |
99 | |
80 | |
70 | |
59 |
User | Count |
---|---|
149 | |
114 | |
107 | |
89 | |
67 |