我是MDX世界的新人,我对clausule有所怀疑。
我有这个查询
WITH
SET [~ROWS] AS
{[Product].[All Products]}
SELECT
NON EMPTY {[Measures].[Quantity]} ON COLUMNS,
NON EMPTY [~ROWS] ON ROWS
FROM [SteelWheelsSales]
WHERE ([Time].[2003] : [Time].[2004])
我想把这个句子添加到哪里。
[Markets].[EMEA].[Ireland]
我该怎么办?我已经尝试过了:WHERE ([Time].[2003] : [Time].[2004], [Markets].[EMEA].[Ireland])
请帮帮我们?
答案 0 :(得分:0)
如果你先在WITH子句中聚合它,那么在WHERE中使用聚合是否还会抱怨?
WITH
SET [~ROWS] AS
{[Product].[All Products]}
SET [dts] AS
{[Time].[2003] : [Time].[2004]}
MEMBER [Time].[All].[dts] AS
AGGREGATE([dts])
SELECT
NON EMPTY {[Measures].[Quantity]} ON COLUMNS,
NON EMPTY [~ROWS] ON ROWS
FROM [SteelWheelsSales]
WHERE ([Time].[All].[dts], [Markets].[EMEA].[Ireland]);
但也许只是通过使用{..}
帮助明确在WHERE子句中:
WITH
SET [~ROWS] AS
{[Product].[All Products]}
SELECT
NON EMPTY {[Measures].[Quantity]} ON COLUMNS,
NON EMPTY [~ROWS] ON ROWS
FROM [SteelWheelsSales]
WHERE (
{[Time].[2003] : [Time].[2004]}
, [Markets].[EMEA].[Ireland]);
答案 1 :(得分:0)
不确定为什么@ whytheq的解决方案对你不起作用。这是类似的,应该有效:
WITH
SET [~ROWS] AS
{[Product].[All Products]}
SELECT
NON EMPTY {[Measures].[Quantity]} ON COLUMNS,
NON EMPTY [~ROWS] ON ROWS
FROM [SteelWheelsSales]
WHERE ({[Time].[2003] : [Time].[2004]} * {[Markets].[EMEA].[Ireland]})
或者您可以选择嵌套的子选择:
WITH
SET [~ROWS] AS
{[Product].[All Products]}
SELECT
NON EMPTY {[Measures].[Quantity]} ON COLUMNS,
NON EMPTY [~ROWS] ON ROWS
FROM (
SELECT [Markets].[EMEA].[Ireland] ON 0
FROM (
SELECT {[Time].[2003] : [Time].[2004]} ON 0
FROM [SteelWheelsSales]
)
)