ssas - How to calculate average based on distinct counts in MDX -
my ssas cube has following fact , dimensions columns shown below
factactivity
datekey, userkey, activitykey, activitycount
dimdate
datekey, date, week, year
dimuser
userkey, username, gender
dimactivity
activitykey, activityname
i have created distinct count measures of users , dates follows
[distinct users]
count(nonempty([dimuser].[userkey].[userkey].members, [measures].[activitycount])
[distinct dates]
count(nonempty([dimdate].[datekey].[datekey].members, [measures].[activitycount])
both these measures working correctly expected when slice/pivot activityname.
now wanted calculate average days per user, created metric follows
[avg days per user]
avg([dimuser].[userkey].[userkey].members, [measures].[distinct dates])
but giving me wrong results.! tried
divide([measures].[distinct days], [measures].[distinct users])
still wrong results...what i'm doing wrong?
maybe adding in existing
help?
avg( existing [dimuser].[userkey].[userkey].members, [measures].[distinct dates] )
although trying recreate similar in advwks seem top valid return without existing
:
with member [measures].[avg count per reseller] avg ( [reseller].[reseller].[reseller].members ,[measures].[reseller order count] ), format_string = "0.0000" select {[measures].[reseller order count],[measures].[avg count per reseller]} on 0 ,{[promotion].[promotion].[all promotions].children} on 1 [adventure works] [date].[calendar year].&[2005];
Comments
Post a Comment