如何在 MDX 查询中使用参数?
How do I use parameter in an MDX query?
我正在使用名为 Region
的参数。它有 3 个值; Region L1
、Region L2
和 Region L3
。
我希望用户访问 select 该区域,这应该会触发 SSAS
中的 MDX
查询。
下面是查询:
select non empty
{([Region].[Region L3].children , [Product Line].[Product Line L2].children)} on rows,
{[Measures].[Clients], [Measures].[Commission]} on columns
from [Products]
因此,报告最初会从下拉列表中询问 select 区域级别。如果用户 selects Region L2
,参数将取 Region L2
的值,查询将是 [Region].[Region L2] .children.
我尝试了 strtoset()
但不确定,我将如何使用它 here.I 不确定我是否可以做类似 [Region].[@Region].children
的事情
您的参数应设置为维度中有效的唯一名称。
="[Region].[Region L2].&[MyRegion]"
或
="[Region].[Region L1].children"
然后在您的 MDX 脚本中使用如下参数:
select non empty STRTOSET(@Region,CONSTRAINED) on rows,
{[Measures].[Clients], [Measures].[Commission]} on columns
from [Products]
因此您必须在填充参数时考虑到它的值必须是参数中有效的唯一名称。
如果您在参数中手动指定值,请使用:
使用表达式在 Value
中生成有效的唯一名称,即:
="[Region].[Region L2].Children"
如果有帮助请告诉我。
我正在使用名为 Region
的参数。它有 3 个值; Region L1
、Region L2
和 Region L3
。
我希望用户访问 select 该区域,这应该会触发 SSAS
中的 MDX
查询。
下面是查询:
select non empty
{([Region].[Region L3].children , [Product Line].[Product Line L2].children)} on rows,
{[Measures].[Clients], [Measures].[Commission]} on columns
from [Products]
因此,报告最初会从下拉列表中询问 select 区域级别。如果用户 selects Region L2
,参数将取 Region L2
的值,查询将是 [Region].[Region L2] .children.
我尝试了 strtoset()
但不确定,我将如何使用它 here.I 不确定我是否可以做类似 [Region].[@Region].children
您的参数应设置为维度中有效的唯一名称。
="[Region].[Region L2].&[MyRegion]"
或
="[Region].[Region L1].children"
然后在您的 MDX 脚本中使用如下参数:
select non empty STRTOSET(@Region,CONSTRAINED) on rows,
{[Measures].[Clients], [Measures].[Commission]} on columns
from [Products]
因此您必须在填充参数时考虑到它的值必须是参数中有效的唯一名称。
如果您在参数中手动指定值,请使用:
使用表达式在 Value
中生成有效的唯一名称,即:
="[Region].[Region L2].Children"
如果有帮助请告诉我。