MDX Type Mismatch error

  • There is a Type mismatch for the '+' operator. The following system error occurred: Type mismatch.

    Hi,

    I'm trying to take values from a set as so below, but keep getting the error :

    Query (2, 13) There is a Type mismatch for the '+' operator.

    The following system error occurred: Type mismatch. .

    For queries like this where the set is like this:

    select {} on 0,

    strtomember('[Date].[Month]' + Strtoset([@DateSet]).item(0) + ']')

    on 1

    from [Adventure Works]

    Any ideas how i can get round this, or fix it.

    Any help much appreciated!!

  • I would be guessing that the StrToSet(x).Item(0) is not returning a string (ie it's returning a member from a set), so tryign to concat a string together with this is failing. You could try MemberToStr around the outside, so 'AAA' + MemberToStr(StrToSet(x).Item(0)) + 'BBB' . Alternatively, depending on the input thats coming in to that variable/parameter, you could simply remove the StrToSet() and Item(0) parts.

    Steve.

  • Also just noticed, and this may be a copy|paste issue introduced in your post, but...

    strtomember('[Date].[Month]' + Strtoset([@DateSet]).item(0) + ']')

    *assuming* StrToSet([@DateSet]).item(0) actually produced a string, and it was 'foo'

    then you would get

    [Date].[Month]foo]

    which seems to be missing 1) the opening square bracket; and 2) the period/dot between Month and member name.

    so something like below might work better once you get your strings sorted

    strtomember('[Date].[Month].[' + Strtoset([@DateSet]).item(0) + ']')

    Steve.

  • Steve thanks for your time.

    I got round it by going for:

    Strtomember("[Delivery Date].[Month of Year].&[" + [Dates].item(0).member_key +"]")

    This sorted it right out.

    Thanks

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply