和-或在MDX查询中

问题描述 投票:0回答:1

请考虑此MDX查询:

SELECT {[Measures].[Internet Sales Amount]} ON COLUMNS,  
[Date].[Calendar Year].MEMBERS ON ROWS  
FROM [Adventure Works]  

如何使用以下三个条件向上述查询添加WHERE子句:

1)其中[Customer].[Customer Geography].[Country].&[United States] AND [Product].[Category].&[Bike]

2)其中[Customer].[Customer Geography].[Country].&[United States] OR [Product].[Category].&[Bike]

3)其中([Customer].[Customer Geography].[Country].&[United States] OR [Product].[Category].&[Bike]) AND [Date].[Year].&[2008]

谢谢

ssas mdx mdx-query
1个回答
0
投票

1)其中[客户]。[客户地理]。[国家/地区]。&[美国]AND [产品]。[类别]。&[自行车]

为此,您的where子句将是

Where ([Customer].[Customer Geography].[Country].&[United States], [Product].[Category].&[Bike])

2)其中[客户]。[客户地理]。[国家/地区]。&[美国]或[产品]。[类别]。&[自行车]

为此,您的Where子句将是

Where 
{([Customer].[Customer Geography].[Country].&[United States], [Product].[Category].defaultmember),
([Customer].[Customer Geography].[Country].[Country], [Product].[Category].&[Bike])}

3)哪里([客户]。[客户地理]。[国家/地区]。[美国]或[产品]。[类别]。[自行车])和[日期]。[年份]。[2008]

为此,您需要修改where子句和on行。因此,对于这一部分,您的查询将是

SELECT {[Measures].[Internet Sales Amount]} ON COLUMNS,  
    [Date].[Calendar Year].&[2011] ON ROWS -- in my sample the strong name of 2011 is &[2011] yours may be diffrent 
    FROM [Adventure Works] 
    Where 
    {([Customer].[Customer Geography].[Country].&[United States], [Product].[Category].defaultmember),
    ([Customer].[Customer Geography].[Country].[Country], [Product].[Category].&[Bike])}
© www.soinside.com 2019 - 2024. All rights reserved.