这是我在 SO 上发布的另一个问题的延续。所以发生的事情COUNT(NONEMPTY
似乎让我计数但DISTINCTCOUNT
没有。我运行函数的集合(值)实际上是不同的。这是我正在使用的查询:
WITH MEMBER Measures.[x] AS
Count(
NONEMPTY(
[Request].[RequestID].children
, {([Measures].[Average of Late Tasks])}
)
)
MEMBER Measures.[y] AS
DISTINCTCOUNT((
[Request].[RequestID].children
, {([Measures].[Average of Late Tasks])}
) )
WITH MEMBER Measures.[z] AS
Count(DISTINCT
NONEMPTY(
[Request].[RequestID].children
, {([Measures].[Average of Late Tasks])}
))
)
SELECT
{Measures.[x], Measures.[y]} ON 0,
[Calendar].[CalendarMonthName].children ON 1
FROM [Model]
WHERE
([Calendar].[CalendarYear].&[2014],
[User].[UserID].&[033343])
输出
x y z
January 1 0 1
February 1 0 1
March 1 0 1
April 1 0 1
May 1 0 1
June 1 0 1
July 1 0 1
August 6 0 6
September 6 0 6
October 7 0 7
November 0 0 0
December 0 0 0
问题是,为什么COUNT(NONEMPTY(
有效但 DISTINCTCOUNT 无效?当 RequestID 都不同时也是如此!
例如,我检查了 8 月份的 RequestID(计数 = 6,见上面的结果)。
我运行了以下 MDX:
SELECT
[Measures].[Average of Late Tasks] ON 0,
non empty ([Calendar].[CalendarMonthName].&[August], [Request].[RequestID].children) ON 1
FROM [Model]
WHERE
([Calendar].[CalendarYear].&[2014],
[User].[UserID].&[033343])
输出
Average of Late Tasks
August 3157 0.00
August 3337 0.00
August 3769 0.00
August 4012 0.00
August 4191 0.00
August 1.22
这意味着它们都是不同的请求!然而,DISTINCTCOUNT
返回 0。这里的后台发生了什么?!