在MDX中,显示所有维度成员的member_key的最佳方法是什么? [英] In MDX, What is the best way to display the member_key of all dimension members?

查看:509
本文介绍了在MDX中,显示所有维度成员的member_key的最佳方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在以下示例中,如何使用"member_key"显示[广告名称暗淡].[广告名称].[名称] .ALLMEMBERS?换句话说,要显示所有广告的唯一ID而不是名称?

In the following example, how can I use the "member_key" for displaying the [Ad Name Dim].[Ad Name].[Name].ALLMEMBERS? in other words, to display ALL ads unique IDs instead of it's names ?

WITH 
  SET [Selected Measures] AS 
{
  [Measures].[Cost]
 ,[Measures].[Clicks]
} 
  MEMBER [Measures].[MinDate] AS 
Head
(
  NonEmpty
  (
    [Time Dim].[Time Dim].[Month] //<<to return minimum month but could be changed to a different level
   ,(
      [Selected Measures]
     ,[Ad Name Dim].[Ad Name].CurrentMember
    )
  )
 ,1
).Item(0).Item(0).Member_Caption 
SELECT 
  {
    [Selected Measures]
   ,[Measures].[MinDate]
   } ON COLUMNS
 ,NonEmpty
  (
    (
      [Ad Name Dim].[Ad Name].[Name].ALLMEMBERS
     ,
        ClosingPeriod
        (
         [Time Dim].[Time Dim].[Month]
        ,[Time Dim].[Time Dim].[All Time]
    ).Lag(3)
      : 
        ClosingPeriod
        (
          [Time Dim].[Time Dim].[Month]
         ,[Time Dim].[Time Dim].[All Time]
       )
   )
 ) ON ROWS
FROM [CubeName];

推荐答案

参考:希望这会有所帮助:

WITH 
SET [Selected Measures] AS 
{
  [Measures].[Cost]
 ,[Measures].[Clicks]
} 
MEMBER [Measures].[MinDate] AS 
Head
(
  NonEmpty
  (
    [Time Dim].[Time Dim].[Month] //<<to return minimum month but could be changed to a different level
   ,(
      [Selected Measures]
     ,[Ad Name Dim].[Ad Name].CurrentMember
    )
  )
 ,1
).Item(0).Item(0).Member_Caption 
MEMBER [Measures].[MemberKey] AS 
  [Ad Name Dim].[Ad Name].currentmember.member_key
SELECT 
  {
   [Measures].[MemberKey]
   ,[Selected Measures]
   ,[Measures].[MinDate]
   } ON COLUMNS
 ,NonEmpty
  (
    (
      [Ad Name Dim].[Ad Name].[Name].ALLMEMBERS
     ,
        ClosingPeriod
        (
         [Time Dim].[Time Dim].[Month]
        ,[Time Dim].[Time Dim].[All Time]
    ).Lag(3)
      : 
        ClosingPeriod
        (
          [Time Dim].[Time Dim].[Month]
         ,[Time Dim].[Time Dim].[All Time]
       )
   )
 ) ON ROWS
FROM [CubeName];

这篇关于在MDX中,显示所有维度成员的member_key的最佳方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆