1
votes

I want to rename the columns that I am querying from the MDX query but in the DIMENSION PROPERTIES, I have tried different approaches (WITH MEMBER / WITH SET ...) but they only work for the rows/columns but not in the DIMENSION PROPERTIES clause. I was hoping to find some help from the community.

What I have in my query is the following:

WITH
MEMBER [Measures].[Closing Balance (HL)] AS [Measures].[1234123]
SELECT
 {
[Measures].[Closing Balance (HL)]
}
 ON AXIS(0) ,
 NON EMPTY
{
[0SALES_OFF].[All].Members.Children
}
DIMENSION PROPERTIES
[0SALES_OFF].[2ZWSALER__0SALES_OFF],
[0SALES_OFF].[1ZWSALER__0SALES_OFF],
 ON AXIS(1)
FROM
 [TABLE_NAME]
SAP VARIABLES [ZVMONYR] INCLUDING "01.2019":"04.2019"

If I query this the resulting table looks like this:

| [0SALES_OFF].[2ZWSALER__0SALES_OFF] | [0SALES_OFF].[1ZWSALER__0SALES_OFF] | [Measures].[Closing Balance (HL)] |
|-------------------------------------|-------------------------------------|-----------------------------------|
| 111                                 | ONE NAME                            | 123.09                            |
| 222                                 | ANOTHER NAME                        | 233.23                            |

But what I want is to rename the columns this way:

| SALES_OFFICE_ID | SALES_OFFICE_NAME | [Measures].[Closing Balance (HL)] |
|-----------------|-------------------|-----------------------------------|
| 111             | ONE NAME          | 123.09                            |
| 222             | ANOTHER NAME      | 233.23                            |

Thank you in advanced for your help!

1

1 Answers

1
votes

I think you could use this approach? https://docs.microsoft.com/en-us/analysis-services/multidimensional-models/mdx/mdx-member-properties-user-defined-member-properties?view=asallproducts-allversions

So create two new measures that take advantage of the CURRENTMEMBER:

WITH 
  MEMBER [Measures].[Closing Balance (HL)] AS 
    [Measures].[1234123] 
  MEMBER [Measures].[SALES_OFFICE_ID] AS 
    [0SALES_OFF].[0SALES_OFF].CurrentMember.Properties("2ZWSALER__0SALES_OFF") 
  MEMBER [Measures].[SALES_OFFICE_NAME] AS 
    [0SALES_OFF].[0SALES_OFF].CurrentMember.Properties("1ZWSALER__0SALES_OFF") 
SELECT 
  {
    [Measures].[Closing Balance (HL)]
   ,[Measures].[SALES_OFFICE_ID]
   ,[Measures].[SALES_OFFICE_NAME]
  } ON AXIS(0)
 ,NON EMPTY 
    {[0SALES_OFF].[All].MEMBERS.Children} ON AXIS(1)
FROM 
[TABLE_NAME]
SAP VARIABLES [ZVMONYR] INCLUDING "01.2019":"04.2019"