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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
ncbshiva
Advocate V
Advocate V

The ALL DAX function is very slow.

Hi Team,

 

I want to calculate some Average Price based on some logic and below is the DAX expression for that.

 

Average Price = CALCULATE(DIVIDE([Dynamic Compare To];[FP&L Volume CompareTo];0);
ALL('AEM Responsibility'[AEM Group];'AEM Responsibility'[AEM Responsibility]);ALL(Market[Market Name]);ALL('Sold-To Party (BV)'[Sold-To Party (BV)]);ALL('Ship-To Party (BV)'[Ship-To Party (BV)]);ALL(Brand[Brand]);ALL('Specific Product'[Specific Product(BV)]))

 

Now if want to create a table with all the above mentioned dimensions along with the Average price it takes very long time to load the table.

 

Below is the DAX query generated by Power BI :

 

VAR __DS0FilterTable11 =
TREATAS({"ABS"}, 'ABS/HL Switch'[Measure Name])

EVALUATE
TOPN(
502,
SUMMARIZECOLUMNS(
ROLLUPADDISSUBTOTAL(
ROLLUPGROUP(
'AEM Responsibility'[AEM Group],
'AEM Responsibility'[AEM Responsibility],
'Sold-To Party (BV)'[Sold-To Party (BV)],
'Market'[Market Name]
), "IsGrandTotalRowTotal"
),
__DS0FilterTable,
__DS0FilterTable2,
__DS0FilterTable3,
__DS0FilterTable4,
__DS0FilterTable5,
__DS0FilterTable6,
__DS0FilterTable7,
__DS0FilterTable8,
__DS0FilterTable9,
__DS0FilterTable10,
__DS0FilterTable11,
"Average_Price", 'KPI'[Average Price]
),
[IsGrandTotalRowTotal],
0,
'AEM Responsibility'[AEM Group],
1,
'AEM Responsibility'[AEM Responsibility],
1,
'Sold-To Party (BV)'[Sold-To Party (BV)],
1,
'Market'[Market Name],
1
)

ORDER BY
[IsGrandTotalRowTotal] DESC,
'AEM Responsibility'[AEM Group],
'AEM Responsibility'[AEM Responsibility],
'Sold-To Party (BV)'[Sold-To Party (BV)],
'Market'[Market Name]

 

Is there any way where i can optimize this DAX expression ? Please help me 

 

Regards

SHIVA 

2 REPLIES 2
v-cherch-msft
Microsoft Employee
Microsoft Employee

Hi @ncbshiva 

It seems you may try to use ALLEXCEPT function.

https://www.sqlbi.com/articles/managing-all-functions-in-dax-all-allselected-allnoblankrow-allexcept...

https://www.sqlbi.com/articles/using-allexcept-versus-all-and-values/

Regards,

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-cherch-msft ,

 

Thanks for the reply , the problem with ALLEXCEPT is i cannot use more than 2 tables.

As you can see in my DAX  formula , i have included around 7 tables.

 

Please let me know how can i improve the speed for this DAX formula.

 

Regards

SHIVA

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors