Cube Browser Woes

I had an interesting issue this week. I was working on a small test cube with financial data. The lowest grain in the measure group was the Account dimension which represents a customer bank account. I had to implement rolling 12 calculations on semi-additive measures (e.g. Avg Account Balance) by weighting the balances at the account level:

Rolling 12 Bal = ∑(Number of Account Active Days * Avg Account Balance) / ∑ (Number of Days for 12-month period

 

Since I had to weight the account balances by the number of the number of the days the account was active, I decided to scope at the account level, e.g.; SCOPE (Leaves(Account), Leaves(Date)…). Also, I had to use the ParallelPeriod() MDX function to sum the weighted balanced for the 12-month period.  To my surprise, the small test cube took an enormous time to initialize in the Cube Browser. The Cube Profiler showed as many subcube events as the number of the accounts of the cube. It appeared that the server was initializing the expression for each account. This didn’t make sense at all considering the fact that the server should only write the formula in the scope cells which should happen pretty fast even with large cubes and very granular scope assignments. After some digging, it turned out that the culprit wasn’t the server but the Cube Browser L. For some obscure reason, the Cube Browser issues the following statement each time you reconnect even with an empty report.

 

select filter([Measures].members, [Measures].currentmember.member_caption = [Measures].currentmember.member_caption) on columns from [<cube name>]

 

This statement was causing the server to evaluate the Account All member which was triggering the formula evaluation for each account. Oops! The moral of this story is to test your cube initialization time in SQL Server Management Studio. As for me, I decided to reduce the scope (always a good idea) to Leaves (Date) only by pro-rating the Active Days in the data source so I could use the days in the month. This makes the formula universal on rows irrespective of the cube slice and makes the Cube Browser happy.