none
MDX: Usage of UNKNOWNMEMBER and error message "The END SCOPE statement does not match the opening SCOPE statement." RRS feed

  • Question

  • Hi,

    At one of my clients we are using several cubes. One of the cubes (Sales) have been copied and is running in the same instance  but different database:

    DatabaseA - CubeSalesOriginal
    DatabaseB - CubeSalesCopy

    CubeSalesOriginal = CubeSalesCopy

    Both cubes are processing at different times (they both point to different data sources) during the day and this is going well for months. Now, suddenly we got a processing error with the copied cube: The END SCOPE statement does not match the opening SCOPE statement.

    Because the functionality did not change of the cubes (we did not adjust them) it should be related to data. When I process the original cube with the data source of the copied cube, we also get this error here. But, looking at the error message, I don't see any relation with data.

    In the MDX code the following code is used (simplified for the example) where the issue points to:

    SCOPE
    (
      FILTER
      ( [Planned Posting Date].[Quarter Name].Children, 
        [Planned Posting Date].[Quarter Name].CurrentMember <> 
        [Planned Posting Date].[Quarter Name].UNKNOWNMEMBER
      ),
      [Planned Posting Date].[Year].Children
    );
    this = 1;      
    END SCOPE;

    What I found out:

    • When I adjust some MDX code and save it, I get the same Scope error as I try to process.
    • When I replace [Planned Posting Date].[Quarter Name].UNKNOWNMEMBER by "Unknown" there are no issues.
    • When I replace [Planned Posting Date].[Quarter Name].UNKNOWNMEMBER by [Planned Posting Date].[Quarter Name].UNKNOWNMEMBER.name there are no issues.

    Any idea what's going on here, what the relation could be with data, and how to solve this?

    Thank you in advance.

    Regards,

    Johan Machielse

    Friday, August 28, 2015 1:21 PM

All replies

  • Hello ,

       Kindly browse your dimension and see whether unknown member existing in the dimension . 

    Regards,

    Bharath

    Monday, August 31, 2015 5:06 AM
  • try and use EXCEPT( [Planned Posting Date].[Quarter Name].Children, [Planned Posting Date].[Quarter Name].[All].UNKNOWNMEMBER)
    Monday, August 31, 2015 7:34 AM
  • Hi Johan,

    According to your description, your SCOPE statement get the "The END SCOPE statement does not match the opening SCOPE statement." error when processing. If you change the UNKNOWNMEMBER into string value, it throws no errors. Right?

    In this scenario, the issue is in your SCOPE statement. This error is thrown when the MDX expression can't be resolved or it contains some calculated measure. In MDX, the "<>" can not be used on member comparison. We can use "IS" operator to compare members. So when you change it into string values like "UNKNOWN" or UNKNOWNMEMBER.name, it works. Since there's no "IS NOT" operator in MDX, you can consider using "CURRENTMEMBER.name <> UNKNOWNMEMBER.name" in your expression. However, the best practice I think is hide the UNKNOWN members and set NullProcessing UNKNOWNMEMBERS so that you don't need to filter members in SCOPE statement. Please refer to: Defining the Unknown Member and Null Processing Properties

    Regards,


    Simon Hou
    TechNet Community Support


    Monday, August 31, 2015 10:16 AM
    Moderator