MDX-使用IIF影响交叉连接中的集合
我有一个像这样的交叉连接MDX-使用IIF影响交叉连接中的集合,mdx,iif,Mdx,Iif,我有一个像这样的交叉连接 SELECT {[Measures].[Respondent Count]} ON COLUMNS ,{ [Groups In Rows].[Group].ALLMEMBERS* [Questions In Rows].[By ShortCode].[Option].ALLMEMBERS* [Questions In Columns].[By ShortCode].[Option].ALLMEMBERS } ON ROW
SELECT
{[Measures].[Respondent Count]} ON COLUMNS
,{
[Groups In Rows].[Group].ALLMEMBERS*
[Questions In Rows].[By ShortCode].[Option].ALLMEMBERS*
[Questions In Columns].[By ShortCode].[Option].ALLMEMBERS
} ON ROWS
FROM [cube]
我希望能够根据参数动态删除行中组的交叉连接,以便在伪mdx中
SELECT
{[Measures].[Respondent Count]} ON COLUMNS
,
IIF(@UseGroups = "yes",
{ [Groups In Rows].[Group].ALLMEMBERS*
[Questions In Rows].[By ShortCode].[Option].ALLMEMBERS*
[Questions In Columns].[By ShortCode].[Option].ALLMEMBERS
},
{
[Questions In Rows].[By ShortCode].[Option].ALLMEMBERS*
[Questions In Columns].[By ShortCode].[Option].ALLMEMBERS
} ON ROWS
FROM [Cube]
这样做可能吗?因为您使用了
@UseGroups
符号,所以我假设您引用的是Reporting Services参数
您可以为查询使用表达式,并根据参数构造查询:
="SELECT { [Measures].[Respondent Count] } ON COLUMNS, "
&" { "
& Iif(@UseGroups = "yes",
"[Groups In Rows].[Group].ALLMEMBERS*",
"[Groups In Rows].[Group].All")
&" [Questions In Rows].[By ShortCode].[Option].ALLMEMBERS* "
&" [Questions In Columns].[By ShortCode].[Option].ALLMEMBERS "
&" } ON ROWS "
&" FROM [Cube]"
由于元数据问题,您必须为Iif
函数的false分支包含All成员