ssas - Last Available value MDX -
i have requirement in extract data cube, within ssrs dataset using query builder ,with time dimension in result set, across range of dates. conditions
- the measures displayed each day of date range.
- the sub total row should have last available measures value time range.
- there time filter (currently single date filter multi select option).
my mdx below.
- the measure has 'sum' aggregation type.
i have calculated measure scope defined below.
scope([measures].[measure1]); scope([date].[date].members); = tail(existing ([date].[date].members),1).item(0) ; end scope; end scope;
this above scope statement works perfectly. however, when select in more 1 date member query slows wayyyyyyy down. performance numbers
- across 1 date - 4 seconds
- across 2 dates - 22 minutes
- across 3 dates - unknown (in hours)
this drastic degradation in performance goes away if remove scope statement, makes me thing there should better way same. final report query below.
select non empty {[measures].[measure1]} on columns ,non empty { [dimension1].[dimension1].[dimension1].allmembers* [dimension2].[dimension2].[dimension2].allmembers* [dimension3].[dimension3].[dimension3].allmembers* [date].[date].[date].allmembers } on rows ( select {[date].[date].&[2014-06-13t00:00:00] ,[date].[date].&[2014-06-16t00:00:00] } on columns [cube] )
so question again is, is there way last available value part of scope statement have better performance? also, if there way write final mdx performance?.
please let me know if there anythings unclear regarding question.
thanks srikanth
the first optimization step change query to
select non empty {[measures].[measure1]} on columns ,non empty { [dimension1].[dimension1].[dimension1].allmembers* [dimension2].[dimension2].[dimension2].allmembers* [dimension3].[dimension3].[dimension3].allmembers* {[date].[date].&[2014-06-13t00:00:00], [date].[date].&[2014-06-16t00:00:00] } } on rows [cube]
furthermore, not sure why added scope([date].[date].memeber);
(probably date].[date].members
, actually). maybe helps omit , corresponding end scope
.
Comments
Post a Comment