dbTalk Databases Forums  

Calculated Member to calc average of top 5 children

microsoft.public.sqlserver.olap microsoft.public.sqlserver.olap


Discuss Calculated Member to calc average of top 5 children in the microsoft.public.sqlserver.olap forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
zee
 
Posts: n/a

Default Calculated Member to calc average of top 5 children - 09-12-2004 , 09:53 PM






I have a Customer Dimension, that looks as follows:

All Customers
Area A
Metro
Customer A
Customer B
Customer C
etc.
Rural
Customer D
Customer E
Customer F
etc.
Area B
Metro
Customer G
Customer H
Customer I
etc.
Rural
Customer J
Customer K
Customer L
etc.

I need to create a calculated member to reflect the average of each
measure for the top 5 customers per region (metro/rural). E.g. Find
the top 5 customers within Area A, Metro. Once they are identified,
sum the measure selected and divide by 5.

Reply With Quote
  #2  
Old   
Jéjé
 
Posts: n/a

Default Re: Calculated Member to calc average of top 5 children - 09-12-2004 , 10:30 PM






maybe a formula like this can help you (not tested):
Avg(TopCount(Customers.Customer.members, 5, Measures.Sales), Sales)

Dividing by 5 is not an option, because if you have only 3 customers you'll
get a wrong result.


"zee" <zelda.calitz (AT) bmw (DOT) com.au> a écrit dans le message de news:
c726d6d2.0409121853.233e0511 (AT) po...OT) google.com...
Quote:
I have a Customer Dimension, that looks as follows:

All Customers
Area A
Metro
Customer A
Customer B
Customer C
etc.
Rural
Customer D
Customer E
Customer F
etc.
Area B
Metro
Customer G
Customer H
Customer I
etc.
Rural
Customer J
Customer K
Customer L
etc.

I need to create a calculated member to reflect the average of each
measure for the top 5 customers per region (metro/rural). E.g. Find
the top 5 customers within Area A, Metro. Once they are identified,
sum the measure selected and divide by 5.



Reply With Quote
  #3  
Old   
zee
 
Posts: n/a

Default Re: Calculated Member to calc average of top 5 children - 09-13-2004 , 06:16 PM



How do you specify that TopCount must be applied to the children of
the relevant hierarchy? I suspect what is happening it that it
calculates the average for the top customers across all the customers.

"Jéjé" <willgart (AT) BBBhotmailAAA (DOT) com> wrote

Quote:
maybe a formula like this can help you (not tested):
Avg(TopCount(Customers.Customer.members, 5, Measures.Sales), Sales)

Dividing by 5 is not an option, because if you have only 3 customers you'll
get a wrong result.


"zee" <zelda.calitz (AT) bmw (DOT) com.au> a écrit dans le message de news:
c726d6d2.0409121853.233e0511 (AT) po...OT) google.com...
I have a Customer Dimension, that looks as follows:

All Customers
Area A
Metro
Customer A
Customer B
Customer C
etc.
Rural
Customer D
Customer E
Customer F
etc.
Area B
Metro
Customer G
Customer H
Customer I
etc.
Rural
Customer J
Customer K
Customer L
etc.

I need to create a calculated member to reflect the average of each
measure for the top 5 customers per region (metro/rural). E.g. Find
the top 5 customers within Area A, Metro. Once they are identified,
sum the measure selected and divide by 5.

Reply With Quote
  #4  
Old   
Jéjé
 
Posts: n/a

Default Re: Calculated Member to calc average of top 5 children - 09-13-2004 , 06:24 PM



this formula list all customers under the current selected member in the
customers dimension:
descendants(Customers.currentmember, Customer)

So, if you select the area "Area A", you'll have only the customers of the
Area A
if you selevct "Area A" --> Metro; you'll have only the customers under this
member.

so the formula become:
Avg(TopCount(descendants(Customers.currentmember, Customer), 5,
Measures.Sales), Sales)


"zee" <zelda.calitz (AT) bmw (DOT) com.au> a écrit dans le message de news:
c726d6d2.0409131516.2aebd5a1 (AT) po...OT) google.com...
Quote:
How do you specify that TopCount must be applied to the children of
the relevant hierarchy? I suspect what is happening it that it
calculates the average for the top customers across all the customers.

"Jéjé" <willgart (AT) BBBhotmailAAA (DOT) com> wrote in message
news:<#rYVGIUmEHA.596 (AT) TK2MSFTNGP11 (DOT) phx.gbl>...
maybe a formula like this can help you (not tested):
Avg(TopCount(Customers.Customer.members, 5, Measures.Sales), Sales)

Dividing by 5 is not an option, because if you have only 3 customers
you'll
get a wrong result.


"zee" <zelda.calitz (AT) bmw (DOT) com.au> a écrit dans le message de news:
c726d6d2.0409121853.233e0511 (AT) po...OT) google.com...
I have a Customer Dimension, that looks as follows:

All Customers
Area A
Metro
Customer A
Customer B
Customer C
etc.
Rural
Customer D
Customer E
Customer F
etc.
Area B
Metro
Customer G
Customer H
Customer I
etc.
Rural
Customer J
Customer K
Customer L
etc.

I need to create a calculated member to reflect the average of each
measure for the top 5 customers per region (metro/rural). E.g. Find
the top 5 customers within Area A, Metro. Once they are identified,
sum the measure selected and divide by 5.



Reply With Quote
  #5  
Old   
zee
 
Posts: n/a

Default Re: Calculated Member to calc average of top 5 children - 09-13-2004 , 11:50 PM



Thanks, I think I have it now.
Avg(TopCount(Descendants([Customers].CurrentMember,
[Customers].[Description]), 5, [Measures].[Quantity Sold]),
[Measures].[Quantity Sold])

zelda.calitz (AT) bmw (DOT) com.au (zee) wrote in message news:<c726d6d2.0409121853.233e0511 (AT) posting (DOT) google.com>...
Quote:
I have a Customer Dimension, that looks as follows:

All Customers
Area A
Metro
Customer A
Customer B
Customer C
etc.
Rural
Customer D
Customer E
Customer F
etc.
Area B
Metro
Customer G
Customer H
Customer I
etc.
Rural
Customer J
Customer K
Customer L
etc.

I need to create a calculated member to reflect the average of each
measure for the top 5 customers per region (metro/rural). E.g. Find
the top 5 customers within Area A, Metro. Once they are identified,
sum the measure selected and divide by 5.

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.