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 |