![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Averages of virtual dimensions .. I have a requirement to get averages for members of one dimension of the virtual dimension member they belong to, give the total number of members having that virtual dimension attribute. I've got this into a (simplified) format relevant for the Foodmart cube - Eg: Foodmart cube: Store Type is virtual dimension from Store. Given a list of stores, retrieve (all) the measures for a year members AND the average measure values for the Store Type for each store. Ie. Info A// Store 19 is a Deluxe Supermarket there are six (6) Deluxe Supermarkets Store 9 is a mid size Grocery there are four (4) Mid Size Groceries Store 10 is a Supermarket there are eight (8) Supermarkets. Simple MDX in two parts is: Select [Measures].Members on columns, { [Store].&[19], [Store].&[9] , [Store].&[10] } on rows From HR where ( [Time].&[1998] ) Info B// Store Org Salary Count Number of Employees Store 19 $5,901.39 888 74 Store 9 $8,275.52 228 19 Store 10 $25,276.31 744 62 Then, Select [Measures].Members on columns, { [Store Type].[Store Type].&[Deluxe Supermarket], [Store Type].[Store Type].&[Mid-Size Grocery] , [Store Type].[Store Type].&[Supermarket] } on rows From HR where ( [Time].&[1998] ) Info C// Store Type Org Salary Count Number of Employees Deluxe Supermarket $104,311.38 5,328 444 Mid-Size Grocery $19,332.22 912 76 Supermarket $73,692.26 5,952 496 Appling the counts from A//, above, we get Info D// Store Type Org Salary Count Number of Employees Deluxe Supermarket $17,385.23 888 74 Mid-Size Grocery $4,833.06 228 19 Supermarket $9,211.53 744 62 So the big question is how, in a single MDX statement does one retrieve: All of Info B// and info D// - in effect Store, Salary, Count, Employee, #ThisType, Avg Sal this type, Avg count this type, Avg Employee this type (the member I call #ThisType is difficult enough to get - I can only manage it for a single store at a time!) For a list of stores that each may have different Store Type... |
#3
| |||
| |||
|
|
Averages of virtual dimensions .. I have a requirement to get averages for members of one dimension of the virtual dimension member they belong to, give the total number of members having that virtual dimension attribute. I've got this into a (simplified) format relevant for the Foodmart cube - .... Store, Salary, Count, Employee, #ThisType, Avg Sal this type, Avg count this type, Avg Employee this type |
| Eg: Foodmart cube: Store Type is virtual dimension from Store. Given a list of stores, retrieve (all) the measures for a year members AND the average measure values for the Store Type for each store. Ie. Info A// Store 19 is a Deluxe Supermarket there are six (6) Deluxe Supermarkets Store 9 is a mid size Grocery there are four (4) Mid Size Groceries Store 10 is a Supermarket there are eight (8) Supermarkets. Simple MDX in two parts is: Select [Measures].Members on columns, { [Store].&[19], [Store].&[9] , [Store].&[10] } on rows From HR where ( [Time].&[1998] ) Info B// Store Org Salary Count Number of Employees Store 19 $5,901.39 888 74 Store 9 $8,275.52 228 19 Store 10 $25,276.31 744 62 Then, Select [Measures].Members on columns, { [Store Type].[Store Type].&[Deluxe Supermarket], [Store Type].[Store Type].&[Mid-Size Grocery] , [Store Type].[Store Type].&[Supermarket] } on rows From HR where ( [Time].&[1998] ) Info C// Store Type Org Salary Count Number of Employees Deluxe Supermarket $104,311.38 5,328 444 Mid-Size Grocery $19,332.22 912 76 Supermarket $73,692.26 5,952 496 Appling the counts from A//, above, we get Info D// Store Type Org Salary Count Number of Employees Deluxe Supermarket $17,385.23 888 74 Mid-Size Grocery $4,833.06 228 19 Supermarket $9,211.53 744 62 So the big question is how, in a single MDX statement does one retrieve: All of Info B// and info D// - in effect Store, Salary, Count, Employee, #ThisType, Avg Sal this type, Avg count this type, Avg Employee this type (the member I call #ThisType is difficult enough to get - I can only manage it for a single store at a time!) For a list of stores that each may have different Store Type... |
#4
| |||
| |||
|
#5
| |||
| |||
|
|
This is very nice technique - I like it. After I've seen Chris's solution, I would like to simplify mine to with member measures.type as 'Store.CurrentMember.Properties("Store Type")' member measures.AvgOrgSalary as 'Avg(NonEmptyCrossJoin([Store].[Store name].members, NonEmptyCrossJoin([store type].[store type].members) ), Measures.[Org Salary] ) ' Select {[Type], [Org Salary], AvgOrgSalary} on columns, {[Store].&[19],[Store].&[9] ,[Store].&[10] }on rows From HR where ( [Time].&[1998] ) -- ================================================== Mosha Pasumansky - www.mosha.com/msolap Development Lead in the Analysis Server team All you need is love (John Lennon) Disclaimer : This posting is provided "AS IS" with no warranties, and confers no rights. ================================================== |
#6
| |||
| |||
|
#7
| |||
| |||
|
![]() |
| Thread Tools | |
| Display Modes | |
| |