Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/80.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql 如何在MDX查询中使用参数?_Sql_Reporting Services_Ssas_Mdx - Fatal编程技术网

Sql 如何在MDX查询中使用参数?

Sql 如何在MDX查询中使用参数?,sql,reporting-services,ssas,mdx,Sql,Reporting Services,Ssas,Mdx,我使用的参数名为区域。它有3个值区域L1,区域L2和区域L3。 我希望用户选择区域,该区域将触发SSAS中的MDX查询。 以下是查询: select non empty {([Region].[Region L3].children , [Product Line].[Product Line L2].children)} on rows, {[Measures].[Clients], [Measures].[Commission]} on columns from

我使用的参数名为
区域
。它有3个值<代码>区域L1,
区域L2
区域L3
。 我希望用户选择区域,该区域将触发
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] 
因此,报告将首先要求从下拉列表中选择区域级别。如果用户选择
Region L2
,参数将取
Region L2
的值,查询将为[Region]。[Region L2]


我尝试了
stroset()
,但不确定如何在这里使用它。我不确定是否可以执行类似
[Region].@Region]的操作。children

您的参数应设置为维度中有效的唯一名称

="[Region].[Region L2].&[MyRegion]"

然后在MDX脚本中使用参数,如下所示:

select non empty STRTOSET(@Region,CONSTRAINED) on rows,
{[Measures].[Clients], [Measures].[Commission]} on columns
from [Products]
因此,必须填充参数,并考虑其值必须是参数中有效的唯一名称

如果要手动指定参数中的值,请使用:

使用表达式在
值中生成有效的唯一名称,即:

="[Region].[Region L2].Children"

如果有帮助,请告诉我。

您的参数应设置为维度中有效的唯一名称

="[Region].[Region L2].&[MyRegion]"

然后在MDX脚本中使用参数,如下所示:

select non empty STRTOSET(@Region,CONSTRAINED) on rows,
{[Measures].[Clients], [Measures].[Commission]} on columns
from [Products]
因此,必须填充参数,并考虑其值必须是参数中有效的唯一名称

如果要手动指定参数中的值,请使用:

使用表达式在
值中生成有效的唯一名称,即:

="[Region].[Region L2].Children"
让我知道这是否有帮助