Question

I have the following dimension:

<Dimension type="StandardDimension" visible="true" foreignKey="ID_CATEGORIE" highCardinality="false" name="DIMENSION_CATEGORIE">
    <Hierarchy name="HIERARCHY_CATEGORIE" visible="true" hasAll="true" primaryKey="ID_CATEGORIE">
    <Table name="CATEGORIE_TICKET" schema="RAPPORT">
    </Table>
     <Level name="CATEGORIE" visible="true" table="CATEGORIE_TICKET" column="ID_CATEGORIE" nameColumn="CATEGORIE" type="String" uniqueMembers="true" levelType="Regular" hideMemberIf="Never">
    </Level>
    </Hierarchy>
</Dimension>  

And the MDX query:

select {[Measures].[COUNT_TICKET]} ON COLUMNS,
  NON EMPTY {[DIMENSION_CATEGORIE.HIERARCHY_CATEGORIE].Children} ON ROWS
from [CUBE_TICKETS_DEPOSES]

which returns the following data:

                    Mesures
HIERARCHY_CATEGORIE COUNT_TICKET
Name1               20
Name2               30
...

Question: Is it possible to to modify the MDX Query in order to output the id of each CATEGORIE column as well, like so:

                                    Mesures
ID         HIERARCHY_CATEGORIE      COUNT_TICKET
id1        Name1                    20
id2        Name2                    30
...

?

My CATEGORIE_TICKET table is:

  ID_CATEGORIE  CATEGORIE
  id1           Name1
  id2           Name2
  ....
Was it helpful?

Solution

Found it:

WITH
    MEMBER [Measures].[Key] AS
         [DIMENSION_CATEGORIE.HIERARCHY_CATEGORIE].CurrentMember.PROPERTIES("KEY")
select {[Measures].Members,  [Measures].[Key] } ON COLUMNS,
  {[DIMENSION_CATEGORIE.HIERARCHY_CATEGORIE].children}  ON ROWS
from [CUBE_TICKETS_DEPOSES]

Which gives:

                               Mesures
HIERARCHY_CATEGORIE      COUNT_TICKET    KEY
Name1                    20              id1
Name2                    30              id2
...
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top