dbTalk Databases Forums  

How to keep unique counts when slicing through data

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


Discuss How to keep unique counts when slicing through data in the microsoft.public.sqlserver.olap forum.



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

Default How to keep unique counts when slicing through data - 06-18-2004 , 02:57 PM






All,

Consider this data:

Run RunCount Team TeamCount Year
(measure) (measure)
-------------------------------------------------
HomeRun 1 Team1 1 2001
Single 1 Team1 0 2001
Walk 1 Team1 0 2001
HomeRun 1 Team1 0 2001
SacFly 1 Team1 0 2001
Double 1 Team1 0 2001
Walk 1 Team1 1 2002
Walk 1 Team1 0 2002
SacFly 1 Team1 0 2002
Single 1 Team1 0 2002
HomeRun 1 Team1 1 2003
Double 1 Team1 0 2003
Walk 1 Team1 0 2003
Single 1 Team1 0 2003
Single 1 Team1 0 2003

Using this Fact Table, I am able to get the average runs (RunCount)
for Team 1 for Year 2002 and 2003. When I try to slice the data by Run
type "Single", I do not get the right average for Year 2002 and 2003.
This is because the TeamCount may be 1 or 0 for Run type "Single"
which depends on the ordering of Run within a Year. So if "Single" is
a 0 for 2002 I get an error. If its not then I get the right count.
The main goal here is to be able to combine averages over more than
one Year. We use proclarity which provides this functionality.

The problem I am having is how to handle the "Single" slice? Any ideas
or pointers on where I can read up on or take a look at samples? I am
stuck and just need a push in the right direction.

Thanks,
brian

Reply With Quote
  #2  
Old   
Deepak Puri
 
Posts: n/a

Default Re: How to keep unique counts when slicing through data - 06-18-2004 , 10:28 PM






Is the Team Count measure intended to try and count the years in a given
slice of the cube? If so, you should use one of the well-known
semi-additive measure techniques:

http://groups.google.com/groups?q=se...roup:microsoft.
public.sqlserver.olap&start=20&hl=en&lr=&ie=UTF-8&group=microsoft.public
.sqlserver.olap&selm=OEHKqCN9CHA.3412%40TK2MSFTNGP 11.phx.gbl&rnum=25
Quote:
From: Deepak Puri (deepak_puri (AT) progressive (DOT) com)
Subject: Re: Average over Time Dim with MDX
View: Complete Thread (4 articles)
Original Format
Newsgroups: microsoft.public.sqlserver.olap
Date: 2003-03-27 18:22:19 PST

Sounds like the classic semi-additive measure requirement. You can refer
to this Microsoft Tech-Ed 2002 PowerPoint:

http://technet.microsoft.at/includes/file.asp?ID=3336
Slide 49>>
1. Average over time

Sum of quantities over all months in the period, divided by the number
of months in the period

Sum( months in the period , Quantity) / Count( months in the period )

Sum(Descendants( Time.CurrentMember,[Month]), Quantity) /
Count(Descendants( Time.CurrentMember,[Month]))

Avg( Descendants( Time.CurrentMember,[Month]), Quantity)
Quote:

- Deepak

*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!


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

Default Re: How to keep unique counts when slicing through data - 06-21-2004 , 11:59 AM



Deepak,

Thanks for you reply.

Team Count is meant to get a unique count of teams within a year. Only
one record for each team in a year is marked with 1. I am having a
problem when the user drills down the Run dimension.

Any other ideas would be appreciated. Thanks.

-Brian

Deepak Puri <deepak_puri (AT) progressive (DOT) com> wrote

Quote:
Is the Team Count measure intended to try and count the years in a given
slice of the cube? If so, you should use one of the well-known
semi-additive measure techniques:

http://groups.google.com/groups?q=se...roup:microsoft.
public.sqlserver.olap&start=20&hl=en&lr=&ie=UTF-8&group=microsoft.public
.sqlserver.olap&selm=OEHKqCN9CHA.3412%40TK2MSFTNGP 11.phx.gbl&rnum=25

From: Deepak Puri (deepak_puri (AT) progressive (DOT) com)
Subject: Re: Average over Time Dim with MDX
View: Complete Thread (4 articles)
Original Format
Newsgroups: microsoft.public.sqlserver.olap
Date: 2003-03-27 18:22:19 PST

Sounds like the classic semi-additive measure requirement. You can refer
to this Microsoft Tech-Ed 2002 PowerPoint:

http://technet.microsoft.at/includes/file.asp?ID=3336
Slide 49
1. Average over time

Sum of quantities over all months in the period, divided by the number
of months in the period

Sum( months in the period , Quantity) / Count( months in the period )

Sum(Descendants( Time.CurrentMember,[Month]), Quantity) /
Count(Descendants( Time.CurrentMember,[Month]))

Avg( Descendants( Time.CurrentMember,[Month]), Quantity)



- Deepak

*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!

Reply With Quote
  #4  
Old   
Deepak Puri
 
Posts: n/a

Default Re: How to keep unique counts when slicing through data - 06-21-2004 , 02:22 PM



What is the average MDX formula that's causing the problem - I assume
that it's (RunCount)/(TeamCount)? In that case, try defining
Measures.TeamCount as a calculation as below,
rather than aggregating it as a cube measure.

Quote:
NonEmptyCrossJoin(Descendants(Time.CurrentMember,[Year]),
Descendants(Team.CurrentMember,[Team])).Count
Quote:

- Deepak

*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!


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.