• 1 reply
  • Latest Post - ‏2014-02-07T07:03:37Z by Paul Mendelson
10 Posts

Pinned topic How to merge Member with String

‏2014-02-06T12:12:59Z |

Hi guys,

Anyone ever done something like question below ?

Trying Concatenate:


substring (cast(current_date;varchar(10));1;4)||substring (cast(current_date;varchar(10));6;2)

I used substring to returns: 201402

Result MUN string:
The result is a string, but not works, how to convert for MUN or member?



  • Paul Mendelson
    Paul Mendelson
    62 Posts

    Re: How to merge Member with String


    First thing to remember, never attempt to do any string concatenation, casting, or finding a current date with a cube, It will only end in tears. In your case you want the member to be constructed before the statement is processed.

    Instead, you can use macros to construct your mun. Macros will modify the select statement before it's sent to the database, so there won't be any issues with unsupported functions.  You could, for instance, do:

    #'[(Cube)].[Period].[Period].[YearMonth]->:[PC].[@MEMBER].[' + timestampMask($current_timestamp,'yyyymm')+']'#

    Look at this post for more details.