![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I've got a quandry that I'm hoping some wise sage can help me with. Background: I've got a cube containing (amongst other things) ticket sales for a group of performances. The relevant dimensions are 1. [p] (performance), with a "performance_date" property and one sub-All level (performance_id), 2. [tixsold] (tickets sold), and 3. [do] (days out, or the sales on a given number of days prior to a given performance's performance_date - the Key for it's one sub-All level, days_out, corresponds to this number, i.e., "do.&[20]") My problem is that I need to generate a result set that lists all open performances (i.e., haven't occured yet), the current tixsold value for the given performance and (here's the issue) the average cumulative tixsold value for an arbitrary number of performances immediately prior to the current performance at the current performance's "days out" value. The only solution I've found that seems to work (the 50 in the LastPeriods function being the aforementioned arbitrary number of prior performances) is along the lines of: WITH MEMBER Measures.days_out AS ' DateDiff( "d" ,Now() ,CDate(p.CurrentMember.Properties("performance_dat e")) ) ' MEMBER Measures.days_out_member_str AS ' IIf( Val(Measures.days_out) < 0 ,"do.&[0]" ,"do.&[" + CStr(Val(Measures.days_out)) + "]" ) ' SET open_perfs AS ' Filter( { p.performance_id.Members } ,Val(Measures.days_out) >= 0 ) ' MEMBER Measures.avg_prior_tixsold AS ' StrToVal( "Avg( LastPeriods( 50 ,p.CurrentMember.PrevMember ) ,Sum( PeriodsToDate( do.[All] ," + CStr(Measures.days_out_member_str) + " ) ,tixsold ) )" ) ' SELECT {Measures.days_out, Measures.tixsold, Measures.avg_prior_tixsold} on columns , { open_perfs } on rows FROM performance_cube The StrToVal seems the only way to apply the open_perfs set's current Measures.days_out value within the context of the Avg function's LastPeriods set. Unfortunately, using StrToVal seems to slow the query's performance beyond the timeout limit of our application (4 min.), especially when other measures are applied or the number of prior performances is large. Does anyone see a more efficient way to generate the average of a group of dimension members while referencing a CurrentMember from the same dimension? Many Thanks In Advance Ian Russell |
#3
| |||
| |||
|
#4
| |||
| |||
|
#5
| |||
| |||
|
| WITH |
![]() |
| Thread Tools | |
| Display Modes | |
| |