【问题标题】:IcCube - Treemap with Parent/Child dimensionIcCube - 具有父/子维度的树形图
【发布时间】:2015-12-11 09:21:59
【问题描述】:

我目前尝试在 IcCube 中构建一个谷歌树形图。我是否使用多级维度执行此操作并分别定义每个向下钻取级别(如图所示 herehere),一切正常。 我想做的是使用父/子维度并告诉树形图,只是在钻入树形图时沿着这个层次结构向下。

这可能吗?

这是我使用的(不工作的)MDX,其中 [categories] 是父/子维度:

WITH
  MEMBER [category_name] as [categories].[categories].currentmember.name 
SELECT
  {[category_name],[Measures].[count_clicks]} on 0,
  non empty [categories].[categories] on 1
FROM
  [Cube]

【问题讨论】:

    标签: parent-child treemap iccube


    【解决方案1】:

    Treemap 是一个棘手的可视化。您需要将前两列定义为定义父/子关系。例如:

    'Global',    null 
    'America',   'Global' 
    'Europe',    'Global'
    'Brazil',    'America'
    

    第一列是 Axis(1) 名称,因此秒必须是父级的名称,而不是成员的名称。类似的东西:

    MEMBER [parent_name] as IIF( [categories].[categories].currentmember is [categories].[categories].[ALL],
                                NULL,
                                [categories].[categories].currentmember.parent.name )
    

    你可以用作:

    WITH
      MEMBER [parent_name] as IIF( [categories].[categories].currentmember is [categories].[categories].[ALL],NULL,[categories].categories].currentmember.parent.name )
    SELECT
      {[parent_name],[Measures].[count_clicks]} on 0,
      non empty [categories].[categories] on 1
    FROM
      [Cube]
    

    这应该会更好。

    希望对你有帮助。

    【讨论】:

      【解决方案2】:

      在用自己的数据挣扎了一段时间后,我采用了父/子维度的 IcCube 示例 (http://www.iccube.com/support/documentation/user_guide/schemas_cubes/dim_parentchild.php)。然后我尝试了您的示例:

      WITH
        MEMBER [parent_name] as IIF( [dim (ALL)].[Hierarchy].currentmember 
        is  [dim (ALL)].[Hierarchy].[ALL],'',
        [dim (ALL)]. [Hierarchy].currentmember.parent.name )
      SELECT
        {[parent_name],[Measures].[value]} on 0,
        non empty [dim (ALL)].[Hierarchy] on 1
      FROM
        [Cube]  
      

      (NULL值必须用''代替)

      第一个维度有效,但如果我尝试深入地图,系统会告诉我,没有 ID 为“世界”的行。你有什么想法,如何解决这个问题?

      编辑: 在父/子维度中使用实名而不是 ids(子:西班牙;父:欧洲,值:3)并将 [dim (ALL)].[Hierarchy] 替换为 [dim (ALL)].[Hierarchy] 之后。 members() 在代码中,我得到了一个树状图:

      WITH
        MEMBER [parent_name] as IIF( [dim (ALL)].[Hierarchy].currentmember 
        is [dim (ALL)].[Hierarchy],'',
        [dim (ALL)].[Hierarchy].currentmember.parent.name )
      SELECT
        {[parent_name],[Measures].[value]} on 0,
        non empty [dim (ALL)].[Hierarchy].members() on 1
      FROM
        [Cube]
      

      现在深入到下一个级别后,出现错误消息“未能找到 ID 为“欧洲”的行”。我在我的数据中添加了一个 3 级(孩子:马德里;父母:西班牙,值:5),但我无法达到这个水平。点击“西班牙”不会改变任何东西。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多