Thursday, February 16, 2012

average of selected members?

I got a measure caled [number of persons]

Now i want another calculated meassure which shows the average number of persons within the selected time period.

My timedimension is :

[Date].[Period].[Month]

Let's say i have

jan - 1000, feb - 1200, mar - 1100, apr - 1000

So if i select "feb" and "mar" in the cube, my average should show 1150

if i select jan,feb,apr i want my average to show 1066,67

is this possible ?

Assuming that you're using AS 2005, something like:

Avg(Existing [Date].[Period].[Month].Members, [Measures].[number of persons])

|||

Ahh yes... This will work if the selection of members is specified in the WHERE statement of the MDX query. However, it will not work if a sub-select/SUBCUBE is used.

See http://www.sqljunkies.com/WebLog/reckless/archive/2006/03/08/18601.aspx for an elaboration on the issue.

No comments:

Post a Comment