Forum Discussion

ncbshiva's avatar
ncbshiva
Icon for Advocate V rankAdvocate V
7 years ago

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