Forum Discussion

FredQ's avatar
FredQ
Frequent Visitor
3 years ago
Solved

Cube.AddAndExpandDimensionColumn and New Column Name

I have tried everything I can think of and I cannot rename a column in the same line as Cube.AddAndExpandDimensionColumn.     Here is the normal line without a rename:   {Cube.AddAndExpandDimensi...
  • FredQ's avatar
    3 years ago

    I figured it out!

     

    I can simply rename it directly in the line by changing the last parameter:

     

    Original created by the system:

     

    {Cube.AddAndExpandDimensionColumn, "[0PROFIT_CTR__ZBBUSINES]", {"[0PROFIT_CTR__ZBBUSINES].[LEVEL01]"}, {"Business.Business Level 01"}},
    {Table.AddColumn, "Business Code", each Cube.AttributeMemberProperty([Business.Business Level 01], "[20PROFIT_CTR__ZBBUSINES]")},

     

    Original I tried this: (change in bold red)

     

    {Cube.AddAndExpandDimensionColumn, "[0PROFIT_CTR__ZBBUSINES]", {"[0PROFIT_CTR__ZBBUSINES].[LEVEL01]"}, {"Business"}},
    {Table.AddColumn, "Business Code", each Cube.AttributeMemberProperty([Business.Business Level 01], "[20PROFIT_CTR__ZBBUSINES]")},

     

    And I got an error.  The reason is not because I cannot do it there, it was becasue I referred to the item in the next row of code and did not change it there.  This is what I needed:

     

    {Cube.AddAndExpandDimensionColumn, "[0PROFIT_CTR__ZBBUSINES]", {"[0PROFIT_CTR__ZBBUSINES].[LEVEL01]"}, {"Business"}},
    {Table.AddColumn, "Business Code", each Cube.AttributeMemberProperty([Business], "[20PROFIT_CTR__ZBBUSINES]")},