dbTalk Databases Forums  

Problem with MDX function DistinctCount

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


Discuss Problem with MDX function DistinctCount in the microsoft.public.sqlserver.olap forum.



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

Default Problem with MDX function DistinctCount - 03-22-2005 , 04:03 AM






Hi, AS guru

I have problem with using of the function DistinctCount (not measure
aggregation type).

All Queries are for Foodmart

Query1 against real Cube Warehouse.

with

member [Measures].[ProductCountM] as 'distinctcount({[Product].[Product
Category].Members})'
member [Measures].[ProductCountB] as
'count(NonemptyCrossJoin([Product].[Product Category].Members))'

select
{[Time].[1997].[Q4].children} on 0,
non empty ({[Store].[All Stores], topcount([Store].[Store Name].members,
1000, ([Measures].[Warehouse Sales], [Time].[1997].[Q4]))} *
{[Measures].[Warehouse Sales], [Measures].[ProductCountB],
[Measures].[ProductCountM]}) on 1
from [Warehouse]
--from [Warehouse and Sales]

thist query gets correct result

The same query against [Warehouse and Sales] gets incorrect result.

If we introduce in the calculated member a measure from the [Warehouse] cube

member [Measures].[ProductCountB] as
'count(NonemptyCrossJoin([Product].[Product Category].Members,
{[Measures].[Warehouse Sales]}))'

,then we get right result for [Measures].[ProductCountB].

In order to get right result for [Measures].[ProductCountM] we must
introduce a <<Dimension>>.CurrentMember for dimension, that only used in the
[Warehouse] cube as following

member [Measures].[ProductCountM] as 'distinctcount({[Product].[Product
Category].Members} * {[Warehouse].CurrentMember})'

The formula with DistinctCount(...) is essentially faster as with
count(NonemptyCrossJoin(...)).

We could I write the formula with DistinctCount(...), if I have virtual cube
that is based on two real cubes that have indentical dimensions?
Is only possible way to solve this problem: to introduce artificial another
dimensions in the real cubes?

Thanks
Vladimir Chtepa










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.