我的 MDX 查询如下:
with set SelectedEntity as '{Union({[Category].[Tertiary Category].Members}, {[Category].[Secondary Category].Members}).Item("Emails")}'
select Crossjoin({[Measures].[Reach]}, {[Age Group].[15-17], [Age Group].[18-24], [Age Group].[25-30], [Age Group].[31-35], [Age Group].[36-40], [Age Group].[40+]}) ON ROWS,
{[SelectedEntity]} ON COLUMNS
from [AppUsage]
where {[Country].[India]}*{[Date].[2011].[April]}*{[Panel].[Syndicate]}
在这里,Item("Emails")
我想传递一个类似这样的变量Item(${category})
。因此我的查询应该变成这样:
with set SelectedEntity as '{Union({[Category].[Tertiary Category].Members}, {[Category].[Secondary Category].Members}).Item(${category})}'
select Crossjoin({[Measures].[Reach]}, {[Age Group].[15-17], [Age Group].[18-24], [Age Group].[25-30], [Age Group].[31-35], [Age Group].[36-40], [Age Group].[40+]}) ON ROWS,
{[SelectedEntity]} ON COLUMNS
from [AppUsage]
where {[Country].[India]}*{[Date].[2011].[April]}*{[Panel].[Syndicate]}
但是尝试将此category
变量传递给此查询它会给我错误,因为无法解析查询。
我不知道哪里出错了?这是在 Item() 中传递变量的正确方法,因为它需要字符串。
注意:${category}
在我想要传递给上述查询的自动完成字段中选择一个实体后,我得到的变量值
编辑:
当我在查询中传递类别变量的值“电子邮件”时,即在上面Item(${category})
,在日志中,相同的查询变为Item(Emails)
。但与其相反,它应该是这样的:Item("Emails")
.
我需要知道如何在 mondrian MDX 查询中将此变量作为字符串传递。