使用生成以串联排名和会员名称(Using GENERATE to concatenate Rank

2019-10-20 04:49发布

以下是从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]

Answer 1:

下面应该工作:

  MEMBER [Measures].[concat] AS 
    cstr(RANK( [Geography].[City].currentmember, orderedcities)) +'.'+ 
    [Geography].[City].currentmember.name 

你仍然将不得不使用演示PROGRAMM摆脱第一冗余列的。

菲利普,



文章来源: Using GENERATE to concatenate Rank and Member Name
标签: ssas mdx olap