Forum Discussion
Cube.AddAndExpandDimensionColumn and New Column Name
- 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]")},
Seems like you almost have it in your last line. But shouldn't the rename follow the initial pattern, like instead of
{"Business.Business Level 01", "Business"}},
{"Business.Business Level 01", "Business.NewColumnName"}},
What are you trying to rename the column?
--Nate
Nope, that gives the same error:
Expression.Error: We expected newColumnNames to have the same number of items as attributeNames.
Details:
[List]
With the current code, the name displayed is Business.Business Level 01. The "." is not treated as a delimiter or anything, it is simply just text.