Hello,
When I execute the following MDX query, I get this error:
Internal error: An unexpected error occurred (file 'mdmodelmd.cpp', line 2669, function 'MDModelMD::DecodeRelAttr').
What does this error mean and how can I avoid this?
The intent of the query is to obtain a table like this:
*The query results are sorted afterwards.
WITH
// top
SET top_category AS TOPCOUNT( [Product].[Category].[Category].Members, 2, [Measures].[Order Quantity] )
SET top_subcategory AS GENERATE(
top_category,
TOPCOUNT( ([Product].[Category].CurrentMember) * [Product].[Subcategory].[Subcategory].Members, 2, [Measures].[Order Quantity] )
)
SET top_product AS GENERATE(
top_subcategory,
TOPCOUNT( ([Product].[Category].CurrentMember, [Product].[Subcategory].CurrentMember) * [Product].[Product].[Product].Members, 2, [Measures].[Order Quantity] )
)
// all
SET all_category AS {[Product].[Category].[All Products]}
SET all_subcategory AS top_category * {[Product].[Subcategory].[All Products]}
SET all_product AS top_subcategory * {[Product].[Product].[All Products]}
// other
SET all_category_ AS [Product].[Category].[Category].Members
MEMBER [Product].[Category].[other_category] AS AGGREGATE( all_category_ - top_category )
SET other_category AS [Product].[Category].[other_category]
SET all_subcategory_ AS top_category * [Product].[Subcategory].[Subcategory].Members
MEMBER [Product].[Subcategory].[other_subcategory] AS AGGREGATE(
EXISTS(all_subcategory_,([Product].[Category].CurrentMember))
- EXISTS(top_subcategory,([Product].[Category].CurrentMember))
)
SET other_subcategory AS top_category * [Product].[Subcategory].[other_subcategory]
SET all_product_ AS top_subcategory * [Product].[Product].[Product].Members
MEMBER [Product].[Product].[other_product] AS AGGREGATE(
EXISTS(all_product_,([Product].[Category].CurrentMember, [Product].[Subcategory].CurrentMember))
- EXISTS(top_product,([Product].[Category].CurrentMember, [Product].[Subcategory].CurrentMember))
)
SET other_product AS top_subcategory * [Product].[Product].[other_product]
SET final AS
top_product
+ all_category * {[Product].[Subcategory].[All Products]} * {[Product].[Product].[All Products]}
+ other_category * {[Product].[Subcategory].[All Products]} * {[Product].[Product].[All Products]}
+ all_subcategory * {[Product].[Product].[All Products]}
+ other_subcategory * {[Product].[Product].[All Products]}
+ all_product
+ other_product
SELECT
[Measures].[Order Quantity] ON 0,
NON EMPTY final ON 1
FROM
[Sales]
In the final set, it seems this line is not working well with others.
Excluding it from the query returns results.
What can be the alternative for the grand total?
+ all_category * {[Product].[Subcategory].[All Products]} * {[Product].[Product].[All Products]}
What is confusing is that this line works well by itself like this.
SET final AS all_category * {[Product].[Subcategory].[All Products]} * {[Product].[Product].[All Products]}
Also, if I query only category and subcategories, there isn't any error.
WITH
// top
SET top_category AS TOPCOUNT( [Product].[Category].[Category].Members, 2, [Measures].[Order Quantity] )
SET top_subcategory AS GENERATE(
top_category,
TOPCOUNT( ([Product].[Category].CurrentMember) * [Product].[Subcategory].[Subcategory].Members, 2, [Measures].[Order Quantity] )
)
// all
SET all_category AS {[Product].[Category].[All Products]}
SET all_subcategory AS top_category * {[Product].[Subcategory].[All Products]}
// other
SET all_category_ AS [Product].[Category].[Category].Members
MEMBER [Product].[Category].[other_category] AS AGGREGATE( all_category_ - top_category )
SET other_category AS [Product].[Category].[other_category]
SET all_subcategory_ AS top_category * [Product].[Subcategory].[Subcategory].Members
MEMBER [Product].[Subcategory].[other_subcategory] AS AGGREGATE(
EXISTS(all_subcategory_,([Product].[Category].CurrentMember))
- EXISTS(top_subcategory,([Product].[Category].CurrentMember))
)
SET other_subcategory AS top_category * [Product].[Subcategory].[other_subcategory]
SET final AS
top_subcategory
+ all_category * {[Product].[Subcategory].[All Products]}
+ other_category * {[Product].[Subcategory].[All Products]}
+ all_subcategory
+ other_subcategory
SELECT
[Measures].[Order Quantity] ON 0,
NON EMPTY final ON 1
FROM
[Sales]
Thank you for your help on this!
SSAS Version: 14.0.6.443