SSAS partition elimination works from SMSS but not from Excel when issuing the same MDX query

26 Views Asked by At

When trying to optimize an Excel pivot report based on an SSAS OLAP connection, I get different results when issuing the MDX query generated by Excel vis SMSS than via Excel. Specifically, a large "Archive" partition, containing data before 2022, is scanned when the MDX is issued from Excel but not when issued from SMSS. The MDX query is limited to Year = 2023. This is the query as captured by SQL Server Profiler when it is sent from Excel:

SELECT NON EMPTY CrossJoin(CrossJoin(CrossJoin(Hierarchize(DrilldownMember({{{DrilldownLevel({[Production].[Production Hierarchy].[All]},,,INCLUDE_CALC_MEMBERS)}}}, 
{[Production].[Production Hierarchy].[Site].&[Porvoo].&[TL4]},,,INCLUDE_CALC_MEMBERS)), Hierarchize({DrilldownLevel({[Misc].[Transaction Type].[All]},,,INCLUDE_CALC_MEMBERS)})), 
Hierarchize({DrilldownLevel({[Materials].[Material Hierarchy].[All]},,,INCLUDE_CALC_MEMBERS)})), Hierarchize({DrilldownLevel({[Misc].[UoM].[All]},,,INCLUDE_CALC_MEMBERS)})) 
DIMENSION PROPERTIES PARENT_UNIQUE_NAME,HIERARCHY_UNIQUE_NAME ON COLUMNS , 
NON EMPTY Hierarchize({DrilldownLevel({DrilldownLevel({DrilldownLevel({[Date and Time].[Date Hierarchy].[All]},,,INCLUDE_CALC_MEMBERS)},[Date and Time].[Date Hierarchy].[Year],INCLUDE_CALC_MEMBERS)},
[Date and Time].[Date Hierarchy].[Month],INCLUDE_CALC_MEMBERS)}) 
DIMENSION PROPERTIES PARENT_UNIQUE_NAME,HIERARCHY_UNIQUE_NAME ON ROWS  
FROM (SELECT ({[Materials].[Material Hierarchy].[Material Group].&[CO2]}) ON COLUMNS , 
({[Date and Time].[Date Hierarchy].[Year].&[2023]}) ON ROWS  
FROM [Flow and Trend View]) 
WHERE ([Date and Time].[Time Offset].[All],[Misc].[Measurement Type].&[FLOW],[Status].[Status Hierarchy].[TAG Status Type].&[Actual],[Measures].[QTY ACT]) 
CELL PROPERTIES VALUE, FORMAT_STRING, LANGUAGE, BACK_COLOR, FORE_COLOR, FONT_FLAGS

I can see in the Profiler that the "Archive" partition is read when the exact same query is issued from Excel but not from SMSS. This has a huge performance impact since most of the time is spent reading the Archive partition.

How can I get the same performance from Excel as from SMSS, avoiding reading the Archive partition which does not contain any data in the scope of the MDX query?

I have tried setting the "Slice" property of the Archive partition to define the years (before 2022) of data which it contains:

{ [Date and Time].[Year].[2014] , [Date and Time].[Year].[2015] , [Date and Time].[Year].[2016] , [Date and Time].[Year].[2017] , [Date and Time].[Year].[2018], [Date and Time].[Year].[2019], [Date and Time].[Year].[2020], [Date and Time].[Year].[2021]}

This works great for MDX queries issued from SMSS but not from Excel.

0

There are 0 best solutions below