以下是从MSDN: http://msdn.microsoft.com/en-us/library/ms144726.aspx
WITH
SET OrderedCities AS Order
([Geography].[City].[City].members
, [Measures].[Reseller Sales Amount], BDESC
)
MEMBER [Measures].[City Rank] AS Rank
([Geography].[City].CurrentMember, OrderedCities)
SELECT {[Measures].[City Rank],[Measures].[Reseller Sales Amount]} ON 0
,Order
([Geography].[City].[City].MEMBERS
,[City Rank], ASC)
ON 1
FROM [Adventure Works]
是否有可能使用GENERATE
函数的等级和城市连接成一列。 所以结果看起来像下面这样:
编辑
所以下面必须越来越近:
WITH
SET OrderedCities AS Order
([Geography].[City].[City].members
, [Measures].[Reseller Sales Amount], BDESC
)
MEMBER [Measures].[City Rank] AS Rank
([Geography].[City].CurrentMember, OrderedCities)
MEMBER [Measures].[memberName] AS
'[Geography].[City].CurrentMember.name'
MEMBER [Measures].[memberValue] AS
'[Measures].[City Rank].value'
MEMBER [Measures].[concat] AS
// [Measures].[memberName] + [Measures].[memberValue]//<<this errors
// '[Measures].[memberName] & [Measures].[memberValue]'//<<this errors
'[Measures].[memberName] + [Measures].[memberValue]'//<<this errors
SELECT
{[Measures].[City Rank],
[Measures].[memberName],
[Measures].[memberValue],
[Measures].[concat],
[Measures].[Reseller Sales Amount]} ON 0
,Order
([Geography].[City].[City].MEMBERS
,[City Rank], ASC)
ON 1
FROM [Adventure Works]