dbTalk Databases Forums  

Problems mith the MDX Count fuction - it returns 2 for a set with 1 element

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


Discuss Problems mith the MDX Count fuction - it returns 2 for a set with 1 element in the microsoft.public.sqlserver.olap forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Thomas Rath \(MIS\)
 
Posts: n/a

Default Problems mith the MDX Count fuction - it returns 2 for a set with 1 element - 07-12-2005 , 11:31 AM






Hello,

I have a MDX statement for the AS2K Foodmart 2000 database which returns
strange results. I want to count the elements of a set of elements and show
it to the user. I modified my original example as much as possible to
reproduce the problem. The result is the MDX statement below - one would
assume that MDX would return 1 as [Customers].[*Count] because there is only
one element in the set - unfortunately it returns two ... I there anyone who
can explain this behavior?

Thanks a lot for any help
Thomas

MDX sample for AS2K Foodmart 2000 database:

with
member [Customers].[*Count] as 'Count({[Customers].[All
Customers].[USA].[CA]})'
member [Product].[<Multiple Selection>] as 'aggregate({[Product].[All
Products].[Drink], [Product].[All Products].[Food]})'
select
{[Customers].[All Customers].[USA].[CA],[Customers].[*Count]} on rows,
{[Gender].[All Gender]} on columns
from [Sales]
where [Product].[<Multiple Selection>]



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

Default Re: Problems mith the MDX Count fuction - it returns 2 for a set with 1 element - 07-15-2005 , 08:46 PM






its not a problem, because you have a multiple selection
In your case you select 2 products, so the "*count" is aggregate 2 times (so
1 + 1 = 2)
if you select 3 products you'll have 3 etc...

I think you want a distinct count measure?
I mean you want top count the unique number of customers with sales in the 2
product.

Lookat the MSDN web site and search for basket analysis & distinct count
measures.

"Thomas Rath (MIS)" <trath (AT) misag (DOT) com> wrote

Quote:
Hello,

I have a MDX statement for the AS2K Foodmart 2000 database which returns
strange results. I want to count the elements of a set of elements and
show it to the user. I modified my original example as much as possible to
reproduce the problem. The result is the MDX statement below - one would
assume that MDX would return 1 as [Customers].[*Count] because there is
only one element in the set - unfortunately it returns two ... I there
anyone who can explain this behavior?

Thanks a lot for any help
Thomas

MDX sample for AS2K Foodmart 2000 database:

with
member [Customers].[*Count] as 'Count({[Customers].[All
Customers].[USA].[CA]})'
member [Product].[<Multiple Selection>] as 'aggregate({[Product].[All
Products].[Drink], [Product].[All Products].[Food]})'
select
{[Customers].[All Customers].[USA].[CA],[Customers].[*Count]} on rows,
{[Gender].[All Gender]} on columns
from [Sales]
where [Product].[<Multiple Selection>]





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.