dbTalk Databases Forums  

unique count is wrong at the top level

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


Discuss unique count is wrong at the top level in the microsoft.public.sqlserver.olap forum.



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

Default unique count is wrong at the top level - 07-20-2006 , 10:47 AM






SQL2K, AS2K. Consider the data table:

VID PID TYPE SUB_TYPE
1 P1 T1 TS1
2 P2 T1 TS2
3 P1 T2 TS1
4 P3 T1 TS2
5 P2 T3 TS3

The 2 measures are VCnt and PCnt.

dim_type would look like:
T1
TS1
TS2
...
T2
TS1
TS2
...

If I filter the data at the level, I would get the following VCnt and PCnt

Level VCnt PCnt
dim_type 5 3
T1 3 3
T2 1 1
T3 1 1
TS1 2 1
TS2 2 2
TS3 1 1

The VCnt works ok. However, the top level count is not a sum of the lower
level cnt for PCnt. How do I do this? Is it possible to build the logic in
OLAP? or I need to go back to SQL to re-build the fact table. Thanks.




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

Default RE: unique count is wrong at the top level - 07-20-2006 , 11:16 AM






Sorry. That's what I am looking for:

Level VCnt PCnt
dim_type 5 3
T1 3 3
TS1 1 1
TS2 2 2
TS3 0 0
T2 1 1
TS1 1 1
TS2 0 0
TS3 0 0
T3 1 1
TS1 0 0
TS2 0 0
TS3 1 1

The PCnt is adding up wrong.

"MJ" wrote:

Quote:
SQL2K, AS2K. Consider the data table:

VID PID TYPE SUB_TYPE
1 P1 T1 TS1
2 P2 T1 TS2
3 P1 T2 TS1
4 P3 T1 TS2
5 P2 T3 TS3

The 2 measures are VCnt and PCnt.

dim_type would look like:
T1
TS1
TS2
...
T2
TS1
TS2
...

If I filter the data at the level, I would get the following VCnt and PCnt

Level VCnt PCnt
dim_type 5 3
T1 3 3
T2 1 1
T3 1 1
TS1 2 1
TS2 2 2
TS3 1 1

The VCnt works ok. However, the top level count is not a sum of the lower
level cnt for PCnt. How do I do this? Is it possible to build the logic in
OLAP? or I need to go back to SQL to re-build the fact table. Thanks.




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

Default Re: unique count is wrong at the top level - 07-20-2006 , 11:57 AM



a Distinct Count measure count the unique values, so a dcount measure will
produce the PCnt result

does its what you looking for?

do you use AS2000 or AS2005?


"MJ" <MJ (AT) discussions (DOT) microsoft.com> wrote

Quote:
Sorry. That's what I am looking for:

Level VCnt PCnt
dim_type 5 3
T1 3 3
TS1 1 1
TS2 2 2
TS3 0 0
T2 1 1
TS1 1 1
TS2 0 0
TS3 0 0
T3 1 1
TS1 0 0
TS2 0 0
TS3 1 1

The PCnt is adding up wrong.

"MJ" wrote:

SQL2K, AS2K. Consider the data table:

VID PID TYPE SUB_TYPE
1 P1 T1 TS1
2 P2 T1 TS2
3 P1 T2 TS1
4 P3 T1 TS2
5 P2 T3 TS3

The 2 measures are VCnt and PCnt.

dim_type would look like:
T1
TS1
TS2
...
T2
TS1
TS2
...

If I filter the data at the level, I would get the following VCnt and
PCnt

Level VCnt PCnt
dim_type 5 3
T1 3 3
T2 1 1
T3 1 1
TS1 2 1
TS2 2 2
TS3 1 1

The VCnt works ok. However, the top level count is not a sum of the lower
level cnt for PCnt. How do I do this? Is it possible to build the logic
in
OLAP? or I need to go back to SQL to re-build the fact table. Thanks.






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.