Search code examples
ssasssmsmdx

Why do i get Parser: The statement dialect could not be resolved due to ambiguity here?


I am trying to get two different topcounts on different rows, guess i am thinking wrong somewhere?

select{
([Measures].[Invoiced_DAm])
} on columns,

    topcount(
        [07 Prod].[Product_Descr].children
        ,10
        ,([Measures].[Invoiced_DAm], [19 Time].[Tr Year].&[2008])
    ),
    topcount(
        [07 Prod].[Product_Descr].children
        ,10
        ,([Measures].[Invoiced_DAm], [19 Time].[Tr Year].&[2009])
    ) on rows

Solution

  • How to get it working is simply put TOPCOUNT operation between curly braces { }:

    select{
    ([Measures].[Invoiced_DAm])
    } on columns,
    {
        topcount(
            [07 Prod].[Product_Descr].children
            ,10
            ,([Measures].[Invoiced_DAm], [19 Time].[Tr Year].&[2008])
        ),
        topcount(
            [07 Prod].[Product_Descr].children
            ,10
            ,([Measures].[Invoiced_DAm], [19 Time].[Tr Year].&[2009])
        )
    } on rows
    

    Why? Beacuse it's the way that MDX distinguishes sets: we are required to surround tuples with braces anytime the tuples are explicitly listed. TOPCOUNT function will return (in this case) the top 10 tuples from Product dimension.

    In your case TOPCOUNT(...), TOPCOUNT(...) means nothing to MDX (two sets, or list of tuples, separate by comma).

    {TOPCOUNT(...), TOPCOUNT(...)} will tell MDX that you want to display the set of rows coming from the two TOPCOUNT statement, so you declare a Set of sets, that is itself a set.