dbTalk Databases Forums  

Custom Rollup problem

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


Discuss Custom Rollup problem in the microsoft.public.sqlserver.olap forum.



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

Default Custom Rollup problem - 03-13-2006 , 02:38 AM






Hi,

Iam having a problem in rolling up the following fact..


Date Product SubType Users
=================================
1-Mar Google Google Mail 30000
1-Mar Google Google Search 40000
2-Mar Google GoogleMail 32000
2-Mar Google Google Search 41000

When I rollup for Month March For Product Google , Users should return
me like this
Average(30000,32000)+ Average(40000,41000)

The logic is If Product and Sub Type matches we need to average them
and If Product and SubType differs we need to Sum Them.

Can any body please help on this.

Regards,
Siva


Reply With Quote
  #2  
Old   
BK
 
Posts: n/a

Default Re: Custom Rollup problem - 03-13-2006 , 12:12 PM






This may be way too simplistic...
if you have "SubType" as one of you dimensions, you should only need to
add a single calculated measure for "average users" so that is you make
a tabular report of your data....

select= [Measure].[_AverageUser_]

SubType
Product Mail Search
=================================
Google 31000 40500
Yahoo 38000 25000
MSN 48000 12000
etc....

Like I said, this may be too simplistic for your solution.


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

Default Re: Custom Rollup problem - 03-13-2006 , 12:21 PM



just realized that you needed to sum the sets of averages... Sorry for
the Waste of Time...


Reply With Quote
  #4  
Old   
T.K. Anand [MSFT]
 
Posts: n/a

Default Re: Custom Rollup problem - 03-13-2006 , 08:09 PM



To compute average, you need a SUM and a COUNT measure. Call them A and B.

Create a calc member:
Avg = A / B

What you want is to compute the average for each SubType and sum it up.
Create another calc member
Foo=SUM(Descendants(ProductHierarchy.CurrentMember , SubType), Avg)

This is a first cut solution. It doesn't account for dimensions other than
Date and Product, but you get the idea...

--
This posting is provided "AS IS" with no warranties, and confers no rights
Please do not send email directly to this alias. This alias is for newsgroup
purposes only.


"sivakk" <kbrsiva (AT) gmail (DOT) com> wrote

Quote:
Hi,

Iam having a problem in rolling up the following fact..


Date Product SubType Users
=================================
1-Mar Google Google Mail 30000
1-Mar Google Google Search 40000
2-Mar Google GoogleMail 32000
2-Mar Google Google Search 41000

When I rollup for Month March For Product Google , Users should return
me like this
Average(30000,32000)+ Average(40000,41000)

The logic is If Product and Sub Type matches we need to average them
and If Product and SubType differs we need to Sum Them.

Can any body please help on this.

Regards,
Siva




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

Default Re: Custom Rollup problem - 03-14-2006 , 12:55 AM



Hi Anand,

Thank you very much for your help.
Iam newbie to this olap world.

Actually , I have few more dimensions to include in this logic. Would
Request you to give an MDX to include one more dimension to your
previous solution.

Fact with another dimension is:

Date Product SubType Country Users
=======================================
1-Mar Google Google Mail USA 30000
1-Mar Google Google Mail UK 40000
1-Mar Google Google Search USA 40000
1-Mar Google Google Search UK 40000
2-Mar Google GoogleMail USA 32000
2-Mar Google Google Search USA 41000

When I rollup for Month March For Product Google , Users should return

me like this

AVERAGE(30000,32000)+AVERAGE(40000)+Average(40000, 41000)+Average(40000)

Here actually I want to compute the average for each SubType and
Country and Sum it up.

Please Please Help me......


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.