Today I needed to look up an element name from an alias. The solution involved combining the use of Dimix and DimNm.
The situation was that I have a System Settings cube which derives the date and subsequently the year, month and day from the date. The month is string and in the form “03”. I wanted to add an element that is also string that shows the month as a three character field, like “Mar”, for example. I have a Month dimension with Jan to Dec in it and alias’ for “03” and “3” etc.
So my challenge was to lookup the Month dimension and find the value of the month in the form “03” and then return the month in the form “Mar”.
['Current Month (mmm)', 'String'] = S: DIMNM( 'Month', DIMIX ('Month', SUBST(TODAY(1),6,2) ) );
So here ‘Current Month (mmm)’ is derived by getting the index number of the two character month number from the Month dimension and then converting that to the element name using DimNm.