开发者

Recurring calculations in SQL 2008 MDX query

I have an MDX query which returns the following tuples:

Dim1A, Dim11, Dim21, Measure1A, Measure11, Measure21
Dim1A, Dim12, Dim22, Measure1A, Measure12, Measure22
Dim1A, Dim13, Dim23, Measure1A, Measure13, Measure23
Dim1A, Dim14, Dim24, Measure1A, Measure14, Measure24
....
....
Dim2A, Dim11, Dim21, Measure2A, Measure11, Measure21
Dim2A, Dim12, Dim22, Measure2A, Measure12, Measure22
Dim2A, Dim13, Dim23, Measure2A, Measure13, Measure23
Dim2A, Dim14, Dim24, Measure2A, Measure14, Measure24

The Measure1A, Measure2A gets repeated for Dim1A, Dim2A and if I have a large set the query response time is slow since MeasureA is an involved calculation. My question is how can I p开发者_如何学Crevent MeasureA from getting computed 4 times for each DimA. So in the above example Measure1A gets calculated 4 times and so does Measure2A. Ideally I would like them to be computed once for each unique DimA


You could try using a query scoped calculated member, if possible with your query. As long as you don't include the currentmember in the calculation it will only get calculated once. Whether this is possible or not will depend on how complex your query is and whether you have a lot of measures to add (Measure1A, Measure2A, Measure3A, etc)

Something like:

WITH 
   MEMBER [Measures].[Measure1a] AS ....your calculation....
SELECT 
 ..... your query
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜