Quantcast
Channel: SQL Server Analysis Services Forum
Viewing all articles
Browse latest Browse all 2472

Calculated members slowing query response times unacceptably

$
0
0

I am having query performance problems with a relatively small cube that are related to a handful of calculated members of my Budget Scenario dimension.

Among the Budget Scenarios used by the business are a collection of “Actual + Budget” scenarios. For example, the value of the “1+10” member is equal to the value of the “Actuals” member if the “Month” attribute of the current time period is “January”; otherwise it is equal to the value of the “Budget” member for the current period. (The cube holds monthly data.)

For ease of navigation, I’ve set up the Budget Scenario dimension as a parent-child dimension with this structure:

Actuals ~

Budget ~

Actuals + Budget ~

   1+11 ~

   2+10 ~

   3+9 ~

  

All of the dimension members are loaded into the cube from a parent-child dimension table.

I first tried to define the calculations for the children of “Actuals + Budget” using “Custom Rollup” formulas carried in the dimension table; however, I could not figure out how to program custom rollup formulas using IIF or CASE statements that would calculate the correct values (at least in a way that they would roll up correctly in the other dimensions). (Note: I am a relative novice at MDX coding, albeit one with extensive OLAP design experience.)

The only way that I could get the values to calculate correctly is using Scope statements like these in the calculation script for the cube:

CALCULATE;

SCOPE ([BUDGET SCENARIO].[BUDGET SCENARIO CATEGORY].&[1+11],[PERIOD DIMENSION].[Period Hierarchy].[PERIOD].&[201201],[Measures].[AMOUNT]);

THIS = ([BUDGET SCENARIO].[BUDGET SCENARIO CATEGORY].&[Actuals],[PERIOD DIMENSION].[Period Hierarchy].[PERIOD].&[201201],[Measures].[AMOUNT]);

ENDSCOPE;

SCOPE ([BUDGET SCENARIO].[BUDGET SCENARIO CATEGORY].&[1+11],[PERIOD DIMENSION].[Period Hierarchy].[PERIOD].&[201202],[Measures].[AMOUNT]);

THIS = ([BUDGET SCENARIO].[BUDGET SCENARIO CATEGORY].&[Budget],[PERIOD DIMENSION].[Period Hierarchy].[PERIOD].&[201202],[Measures].[AMOUNT]);

ENDSCOPE;

SCOPE ([BUDGET SCENARIO].[BUDGET SCENARIO CATEGORY].&[1+11],[PERIOD DIMENSION].[Period Hierarchy].[PERIOD].&[201203],[Measures].[AMOUNT]);

THIS = ([BUDGET SCENARIO].[BUDGET SCENARIO CATEGORY].&[Budget],[PERIOD DIMENSION].[Period Hierarchy].[PERIOD].&[201203],[Measures].[AMOUNT]);

ENDSCOPE;

This approach produces the correct amounts; however, to calculate two years’ worth of Actual + Budget member values requires 288 of these scope statements. Not surprisingly, when a query includes one or more of these Actual + Budget values, the response time degrades from split second to 5 minutes or more, which is unacceptable.

“Warming the Cache” helps, but does not solve the problem, completely (and it takes 5 to 20 minutes to properly warm the cache at the end of cube processing).

I have also tried to create an aggregation to force the cube to process all of the leaf-level members of the Budget Scenario dimension when the cube is reloaded and processed; however, I have not been successful in this. The cube is so small that the SSAS aggregation heuristics don’t believe that there is any value in pre-aggregating anything, and I haven’t found a way to force it to pre-aggregate anything. (The aggregation level stubbornly stays at 0 percent no matter what I tell it to do.)

I know that there are certain types of Calculated Members/Measures that SSAS will only calculate at query time, but the four books on MDX that I have are all so ambiguous about what falls into this category that I can’t tell whether or not this is my problem.

Any ideas about how to refactor my calc script to make it run more efficiently and/or how to force SSAS to precalulate these values?


Steve Elkins


Viewing all articles
Browse latest Browse all 2472

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>