读书人

请问一个MDX查询

发布时间: 2013-01-02 13:08:44 作者: rapoo

请教一个MDX查询
我想查北京地区3月份和南京地区4月份各产品的销售额。

刚学MDX,我想两个集合分别求交集,再求两个交集的并集,见下面的Where字句:
不知道这个方法有没有问题。


select [Measure].[sale count] on 0,

[Product].[Name] on 1

from Adventure

where(

StrToSet("[City].&[BJ]")*

StrToSet("[Date].[Month].&[3]")+

StrToSet("[City].&[NJ]")*

StrToSet("[Date].[Month].&[4]")

)

这样写报错:

“对于任意形状,如果其元素跨引用维度,则不允许使用它。”

不知道错误信息是什么意思 。

[解决办法]
我想这样的结果是不是一样的?
select [Measure].[sale count] on 0,

[Product].[Name] on 1

from Adventure

where{

([City].&[BJ],[Date].[Month].&[3]),

([City].&[NJ],[Date].[Month].&[4])
}
[解决办法]
select [Measure].[sale count] on 0,

[Product].[Name] on 1


from Adventure
where
crossjion
({[City].&[BJ]}, {[Date].[Month].&[3]}),
crossjion
({[City].&[nj]}, {[Date].[Month].&[4]})


[解决办法]
select [Measure].[sale count] on 0,

[Product].[Name] on 1


from Adventure
where
crossjion
({[City].&[BJ]}, {[Date].[Month].&[3]}),
crossjion
({[City].&[nj]}, {[Date].[Month].&[4]})
[解决办法]
with measure [City].[temp] 'aggredate({[City].&[BJ],[City].&[nj]})'
measure [Date].[Month].[temp]'aggredate({[Date].[Month].&[3],[Date].[Month].&[4]})'

select [Measure].[sale count] on 0,

[Product].[Name] on 1


from Adventure
where
([City].[temp],[Date].[Month].[temp])

----

读书人网 >数据库开发

热点推荐