2011-12-16 4 views
1

나는 동적 매개 변수에 따라 행 그룹에 crossjoin를 제거 할 수 있도록하려면이MDX - crossjoin에 세트에 영향을 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 ROWS 
FROM [cube] 

처럼 보이는 crossjoin을 가질 수 있도록 의사에 우리가 가질 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] 

이게 뭔가요?

답변

0

@UseGroups 표기법을 사용하고 있으므로 Reporting Services 매개 변수를 참조한다고 가정합니다.

당신은 쿼리 식을 사용하고 매개 변수에 관해서 쿼리를 구성 할 수 있습니다

: 때문에 메타 데이터 문제, 당신은 Iif 함수의 잘못된 지점의 모든 구성원을 포함해야

="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]" 

.