SQL Server - More than one slices from same dimension in Where clause not working

Asked By rupnicegu
17-Nov-09 03:35 AM
SELECT NON EMPTY {TopCount({Crossjoin({[Measures].[Average Sales
Amount]},{[Date].[Fiscal].[(All)].AllMembers})},20,[Measures].[Average
Sales Amount])} ON COLUMNS,
NON EMPTY {hierarchize(TopCount({[Geography].[Geography].
[(All)].AllMembers},20,[Measures].[Average Sales Amount]))} ON ROWS
FROM "Adventure Works"
WHERE ([Product].[Color].&[Black],[Product].[Color].&[Red])

Executing the query ...
The 'Color' hierarchy appears more than once in the tuple.
Execution complete

The issue is with using more than once slices from same dimension in
where clause e.g. ([Product].[Color].&[Black],[Product].[Color].&
[Red])

I have to use more than one slices from same dimension. But the MDX is
failing with error, please suggest how to acheive this?

Best Regards,
Rupesh
AllMembers
(1)
TopCount
(1)
Crossjoin
(1)
Geography
(1)
Measures
(1)
Rupesh
(1)
Hierarchize
(1)
Acheive
(1)
  Zheng Xie replied to rupnicegu
18-Nov-09 03:25 AM
In ([Product].[Color].&[Black],[Product].[Color].&[Red]), the () is a
tuple which needs members from different hierarchies.

If you only want to aggregate them, you can simply change ([Product].
[Color].&[Black],[Product].[Color].&[Red]) to be {[Product].[Color].&
[Black],[Product].[Color].&[Red]}.
  rupnicegu replied to Zheng Xie
19-Nov-09 09:32 AM
Thanks a lot. It really helped!

Best Regards,
Rupesh
Create New Account
help
Sorting needed in MDX with Topcount and NON Empty Filter SQL Server Hi, Can any one help me with sorting the that is first for 2002, then 2003, then 2004. . in this order. . . SELECT NON EMPTY {TopCount({Crossjoin({[Measures].[Reseller Sales Amount]}, {[Geography].[Geography].[(All)].AllMembers})}, 20, [Measures]. [Reseller Sales Amount])} ON COLUMNS, NON EMPTY {TopCount({[Delivery Date].[Fiscal].[All Periods].Children}, 20, [Measures].[Reseller Sales Amount])} ON ROWS FROM "Adventure Works" the below query which does not use any filter and topcount works fine. . .and gives sorted data year wise. . . SELECT {Crossjoin({[Measures].[Reseller Sales Amount]}, {[Geography]. [Geography].[(All)].AllMembers})} ON COLUMNS, {[Delivery Date].[Fiscal].[All Periods].Children} ON ROWS FROM "Adventure Works" is it
what is going on here. Thanks! This is the one not working: SELECT NON EMPTY CROSSJOIN(CROSSJOIN(CROSSJOIN(CROSSJOIN(CROSSJOIN(CROSSJOIN(HIERARCHIZE(AddCalculatedMembers({DrillDownLevel({[Invoice Map].[Ship To Geo].[All]})})), HIERARCHIZE(AddCalculatedMembers({DrillDownLevel({[Carrier Service Level Cell set consists of 8 rows and 80005 columns. This one works: SELECT NON EMPTY CROSSJOIN(CROSSJOIN(CROSSJOIN(CROSSJOIN(CROSSJOIN(CROSSJOIN(HIERARCHIZE(AddCalculatedMembers({DrillDownLevel({[Invoice Map].[Ship To Geo].[All]})})), HIERARCHIZE(AddCalculatedMembers