如果成员标识符名称不同,多维数据集的 Mdx 查询将为 "With Member" 返回不同的结果
Mdx query for cube is returning different results for "With Member" if member identifier name is different
我正在启动 mdxquery 以使用 "With Member" 为不同的单元格获取不同的元组集组合。我的要求是在单个 mdx 查询中查询具有多个维度的元组。
根据我的理解,成员标识符只是一个别名,它不应该影响查询的结果。但是如果我使用不同的成员标识符,它会为同一个查询返回不同的结果集。过滤器所在的切片器也相同。
我的要求是我有一组元组,每个元组都有不同的成员 Dimensions/attributes 组合,我只想触发一个查询来获取每个元组集的数据。所以我正在使用 "With Member" 选项,它允许命名成员集具有不同的维度。
查询 1、查询 2、查询 3 几乎相同,只是使用的成员名称不同。非常感谢任何帮助或建议。
Query 1:
With
MEMBER [Account].[9] AS '([Account].&[500],[Department].&[102])'
MEMBER [Account].[1] AS '([Account_Text].[Account_Text_Level].&[-1],[Account].&[161])'
MEMBER [Account].[6] AS '([Account].&[500],[Account_Group].&[214])'
MEMBER [Account].[10] AS '([Account].&[1])'
MEMBER [Account].[13] AS '([Account].&[2881],[Company].&[173])'
MEMBER [Account].[4] AS '([Company].&[1],[Company_Text].&[-1],[Account].&[500],[Account_Group].&[215],[Account_Text].[Account_Text_Level].&[-1],[Department].&[103])'
Select
{[Account].[9],[Account].[1],[Account].[6],[Account].[10],[Account].[13],[Account].[4]}
Dimension Properties [Parent_Unique_Name] On Columns From [Adventure Works]
Where ([BusinessCenter].&[1],[CalculatedDim].&[1],[CostCenter].&[1],[Department].&[1],[Geography].&[1],[ICSegment].&[1],
[ProductLine].&[1],[Reporting].[Level 1].&[14],[Company].&[1],[Scenario].&[1],[Time].&[2014])
Query 2:
With
MEMBER [Test9] AS '([Account].&[500],[Department].&[102])'
MEMBER [Test1] AS '([Account_Text].[Account_Text_Level].&[-1],[Account].&[161])'
MEMBER [Test2] AS '([Account].&[500],[Account_Group].&[214])'
MEMBER [Test10] AS '([Account].&[1])'
MEMBER [Test13] AS '([Account].&[2881],[Company].&[173])'
MEMBER [Test4] AS '([Company].&[1],[Company_Text].&[-1],[Account].&[500],[Account_Group].&[215],[Account_Text].[Account_Text_Level].&[-1],[Department].&[103])'
Select
{[Test9],[Test1],[Test2],[Test10],[Test13],[Test4]}
Dimension Properties [Parent_Unique_Name]
On Columns From [Adventure Works]
Where ([BusinessCenter].&[1],[CalculatedDim].&[1],[CostCenter].&[1],[Department].&[1],[Geography].&[1],
[ICSegment].&[1],
[ProductLine].&[1],[Reporting].[Level 1].&[14],[Company].&[1],[Scenario].&[1],[Time].&[2014]
)
Query 3:
With
MEMBER [Company].[9] AS '([Account].&[500],[Department].&[102])'
MEMBER [Company].[1] AS '([Account_Text].[Account_Text_Level].&[-1],[Account].&[161])'
MEMBER [Company].[6] AS '([Account].&[500],[Account_Group].&[214])'
MEMBER [Company].[10] AS '([Account].&[1])'
MEMBER [Company].[13] AS '([Account].&[2881],[Company].&[173])'
MEMBER [Company].[4] AS '([Company].&[1],[Company_Text].&[-1],[Account].&[500],[Account_Group].&[215],[Account_Text].[Account_Text_Level].&[-1],[Department].&[103])'
Select
{[Company].[9],[Company].[1], [Company].[6],[Company].[10],[Company].[13],[Company].[4]}
Dimension Properties [Parent_Unique_Name] On Columns From [Adventure Works]
Where ([BusinessCenter].&[1],[CalculatedDim].&[1],[CostCenter].&[1],[Department].&[1],[Geography].&[1],[ICSegment].&[1],
[ProductLine].&[1],[Reporting].[Level 1].&[14],[Scenario].&[1],[Time].&[2014],[Account].&[1])
我的回答是基于您的评论。
I have a set of tuples and each tuple has different members and I want
to fire only one query to get data for each of these tuple sets. So I
am using "With Member" option which allows having named member sets
having different dimensionality. – Sudi
你的问题涉及维度和层次结构的概念。层次性表示集合中的所有元组应包含相同的 dimension-hierarchies,维度表示它们必须处于相同的顺序。因此,如果一个元组缺少一个成员,您可以在查询中使用它的默认成员,以满足 属性。这不会影响结果,因为这是查询处理器对您在元组中遗漏的每个维度所做的。您的查询将是这样的。
Select
{
([Account].&[500], [Department].&[102], [Account_Text].[Account_Text_Level].defaultmember, [Account_Group].[YourHierarchy].defaultmember, [Company].[YourHierarchy].defaultmember,[Company_Text].[YourHierarchy].defaultmember),
([Account].&[161], [Department].[Youhierarchy].defaultmember, [Account_Text].[Account_Text_Level].&[-1], [Account_Group].[YourHierarchy].defaultmember, [Company].[YourHierarchy].defaultmember,[Company_Text].[YourHierarchy].defaultmember),
([Account].&[500], [Department].[Youhierarchy].defaultmember, [Account_Text].[Account_Text_Level].defaultmember, [Account_Group].&[214] , [Company].[YourHierarchy].defaultmember,[Company_Text].[YourHierarchy].defaultmember),
([Account].&[1], [Department].[Youhierarchy].defaultmember, [Account_Text].[Account_Text_Level].defaultmember, [Account_Group].[YourHierarchy].defaultmember, [Company].[YourHierarchy].defaultmember,[Company_Text].[YourHierarchy].defaultmember),
([Account].&[2881],[Department].[Youhierarchy].defaultmember, [Account_Text].[Account_Text_Level].defaultmember, [Account_Group].[YourHierarchy].defaultmember, [Company].&[173]),
([Account].&[500], [Department].&[103], [Account_Text].[Account_Text_Level].&[-1], [Account_Group].&[215] ,[Company].&[1] ,[Company_Text].&[-1])
}
Dimension Properties [Parent_Unique_Name] On Columns
From [Adventure Works]
Where
([BusinessCenter].&[1],[CalculatedDim].&[1],
[CostCenter].&[1],[Department].&[1],
[Geography].&[1],[ICSegment].&[1],
[ProductLine].&[1],[Reporting].[Level 1].&[14],
[Company].&[1],[Scenario].&[1],[Time].&[2014])
编辑:根据下面的评论
看看
select
[Measures].[Internet Sales Amount]
on columns,
([Date].[Calendar Year].&[2012],[Product].[Category].&[1])
on
rows
from [Adventure Works]
结果
二元组
select
[Measures].[Internet Sales Amount]
on columns,
([Date].[Calendar Year].&[2012],[Customer].[Country].&[United States])
on
rows
from [Adventure Works]
结果:
三元组
select
[Measures].[Internet Sales Amount]
on columns,
{
([Customer].[Gender].&[F],[Product].[Category].&[3])
}
on
rows
from [Adventure Works]
结果
现在让我们合并它们
select
[Measures].[Internet Sales Amount]
on columns,
{
([Date].[Calendar Year].&[2012],[Product].[Category].&[1],[Customer].[Country].defaultmember,[Customer].[Gender].defaultmember),
([Date].[Calendar Year].&[2012],[Product].[Category].defaultmember,[Customer].[Country].&[United States],[Customer].[Gender].defaultmember),
([Date].[Calendar Year].defaultmember,[Product].[Category].&[3],[Customer].[Country].defaultmember,[Customer].[Gender].&[F])
}
on
rows
from [Adventure Works]
结果
我正在启动 mdxquery 以使用 "With Member" 为不同的单元格获取不同的元组集组合。我的要求是在单个 mdx 查询中查询具有多个维度的元组。 根据我的理解,成员标识符只是一个别名,它不应该影响查询的结果。但是如果我使用不同的成员标识符,它会为同一个查询返回不同的结果集。过滤器所在的切片器也相同。 我的要求是我有一组元组,每个元组都有不同的成员 Dimensions/attributes 组合,我只想触发一个查询来获取每个元组集的数据。所以我正在使用 "With Member" 选项,它允许命名成员集具有不同的维度。
查询 1、查询 2、查询 3 几乎相同,只是使用的成员名称不同。非常感谢任何帮助或建议。
Query 1:
With
MEMBER [Account].[9] AS '([Account].&[500],[Department].&[102])'
MEMBER [Account].[1] AS '([Account_Text].[Account_Text_Level].&[-1],[Account].&[161])'
MEMBER [Account].[6] AS '([Account].&[500],[Account_Group].&[214])'
MEMBER [Account].[10] AS '([Account].&[1])'
MEMBER [Account].[13] AS '([Account].&[2881],[Company].&[173])'
MEMBER [Account].[4] AS '([Company].&[1],[Company_Text].&[-1],[Account].&[500],[Account_Group].&[215],[Account_Text].[Account_Text_Level].&[-1],[Department].&[103])'
Select
{[Account].[9],[Account].[1],[Account].[6],[Account].[10],[Account].[13],[Account].[4]}
Dimension Properties [Parent_Unique_Name] On Columns From [Adventure Works]
Where ([BusinessCenter].&[1],[CalculatedDim].&[1],[CostCenter].&[1],[Department].&[1],[Geography].&[1],[ICSegment].&[1],
[ProductLine].&[1],[Reporting].[Level 1].&[14],[Company].&[1],[Scenario].&[1],[Time].&[2014])
Query 2:
With
MEMBER [Test9] AS '([Account].&[500],[Department].&[102])'
MEMBER [Test1] AS '([Account_Text].[Account_Text_Level].&[-1],[Account].&[161])'
MEMBER [Test2] AS '([Account].&[500],[Account_Group].&[214])'
MEMBER [Test10] AS '([Account].&[1])'
MEMBER [Test13] AS '([Account].&[2881],[Company].&[173])'
MEMBER [Test4] AS '([Company].&[1],[Company_Text].&[-1],[Account].&[500],[Account_Group].&[215],[Account_Text].[Account_Text_Level].&[-1],[Department].&[103])'
Select
{[Test9],[Test1],[Test2],[Test10],[Test13],[Test4]}
Dimension Properties [Parent_Unique_Name]
On Columns From [Adventure Works]
Where ([BusinessCenter].&[1],[CalculatedDim].&[1],[CostCenter].&[1],[Department].&[1],[Geography].&[1],
[ICSegment].&[1],
[ProductLine].&[1],[Reporting].[Level 1].&[14],[Company].&[1],[Scenario].&[1],[Time].&[2014]
)
Query 3:
With
MEMBER [Company].[9] AS '([Account].&[500],[Department].&[102])'
MEMBER [Company].[1] AS '([Account_Text].[Account_Text_Level].&[-1],[Account].&[161])'
MEMBER [Company].[6] AS '([Account].&[500],[Account_Group].&[214])'
MEMBER [Company].[10] AS '([Account].&[1])'
MEMBER [Company].[13] AS '([Account].&[2881],[Company].&[173])'
MEMBER [Company].[4] AS '([Company].&[1],[Company_Text].&[-1],[Account].&[500],[Account_Group].&[215],[Account_Text].[Account_Text_Level].&[-1],[Department].&[103])'
Select
{[Company].[9],[Company].[1], [Company].[6],[Company].[10],[Company].[13],[Company].[4]}
Dimension Properties [Parent_Unique_Name] On Columns From [Adventure Works]
Where ([BusinessCenter].&[1],[CalculatedDim].&[1],[CostCenter].&[1],[Department].&[1],[Geography].&[1],[ICSegment].&[1],
[ProductLine].&[1],[Reporting].[Level 1].&[14],[Scenario].&[1],[Time].&[2014],[Account].&[1])
我的回答是基于您的评论。
I have a set of tuples and each tuple has different members and I want to fire only one query to get data for each of these tuple sets. So I am using "With Member" option which allows having named member sets having different dimensionality. – Sudi
你的问题涉及维度和层次结构的概念。层次性表示集合中的所有元组应包含相同的 dimension-hierarchies,维度表示它们必须处于相同的顺序。因此,如果一个元组缺少一个成员,您可以在查询中使用它的默认成员,以满足 属性。这不会影响结果,因为这是查询处理器对您在元组中遗漏的每个维度所做的。您的查询将是这样的。
Select
{
([Account].&[500], [Department].&[102], [Account_Text].[Account_Text_Level].defaultmember, [Account_Group].[YourHierarchy].defaultmember, [Company].[YourHierarchy].defaultmember,[Company_Text].[YourHierarchy].defaultmember),
([Account].&[161], [Department].[Youhierarchy].defaultmember, [Account_Text].[Account_Text_Level].&[-1], [Account_Group].[YourHierarchy].defaultmember, [Company].[YourHierarchy].defaultmember,[Company_Text].[YourHierarchy].defaultmember),
([Account].&[500], [Department].[Youhierarchy].defaultmember, [Account_Text].[Account_Text_Level].defaultmember, [Account_Group].&[214] , [Company].[YourHierarchy].defaultmember,[Company_Text].[YourHierarchy].defaultmember),
([Account].&[1], [Department].[Youhierarchy].defaultmember, [Account_Text].[Account_Text_Level].defaultmember, [Account_Group].[YourHierarchy].defaultmember, [Company].[YourHierarchy].defaultmember,[Company_Text].[YourHierarchy].defaultmember),
([Account].&[2881],[Department].[Youhierarchy].defaultmember, [Account_Text].[Account_Text_Level].defaultmember, [Account_Group].[YourHierarchy].defaultmember, [Company].&[173]),
([Account].&[500], [Department].&[103], [Account_Text].[Account_Text_Level].&[-1], [Account_Group].&[215] ,[Company].&[1] ,[Company_Text].&[-1])
}
Dimension Properties [Parent_Unique_Name] On Columns
From [Adventure Works]
Where
([BusinessCenter].&[1],[CalculatedDim].&[1],
[CostCenter].&[1],[Department].&[1],
[Geography].&[1],[ICSegment].&[1],
[ProductLine].&[1],[Reporting].[Level 1].&[14],
[Company].&[1],[Scenario].&[1],[Time].&[2014])
编辑:根据下面的评论
看看
select
[Measures].[Internet Sales Amount]
on columns,
([Date].[Calendar Year].&[2012],[Product].[Category].&[1])
on
rows
from [Adventure Works]
结果
二元组
select
[Measures].[Internet Sales Amount]
on columns,
([Date].[Calendar Year].&[2012],[Customer].[Country].&[United States])
on
rows
from [Adventure Works]
结果:
三元组
select
[Measures].[Internet Sales Amount]
on columns,
{
([Customer].[Gender].&[F],[Product].[Category].&[3])
}
on
rows
from [Adventure Works]
结果
现在让我们合并它们
select
[Measures].[Internet Sales Amount]
on columns,
{
([Date].[Calendar Year].&[2012],[Product].[Category].&[1],[Customer].[Country].defaultmember,[Customer].[Gender].defaultmember),
([Date].[Calendar Year].&[2012],[Product].[Category].defaultmember,[Customer].[Country].&[United States],[Customer].[Gender].defaultmember),
([Date].[Calendar Year].defaultmember,[Product].[Category].&[3],[Customer].[Country].defaultmember,[Customer].[Gender].&[F])
}
on
rows
from [Adventure Works]
结果