我有这个查询,我需要实现二维
WITH
SET [TCat] AS
TopCount([Product].[Subcategory].[Subcategory],10,[Measures].[Sales Amount])
MEMBER [Product].[Subcategory].[Other] AS
Aggregate([Product].[Subcategory].[Subcategory] - TCat)
SELECT { [Measures].[Sales Amount] } ON COLUMNS,
TCat + [Other] ON ROWS
FROM [Adventure Works]
我尝试但它不适用于二维
WITH
SET FIPS as
[Geography].[State-Province].[State-Province]
//TopCount([Product].[Subcategory].[Subcategory],10,[Measures].[Sales Amount])
SET [TCat] AS
Generate( {FIPS}, CrossJoin( {[Geography].[State-Province].CurrentMember}, topsum( ([Product].[Subcategory].[Subcategory]), 2, [Measures].[Sales Amount] ) ))
MEMBER [Product].[Subcategory].[Other] AS
Aggregate(Except( [Product].[Subcategory].[Subcategory].Members, TCat))
SELECT
{ [Measures].[Sales Amount] } ON COLUMNS,
Union(
TCat , {[Geography].[State-Province].[State-Province],[Product].[Subcategory].[Other]} ) ON ROWS
FROM [Adventure Works];
答案 0 :(得分:0)
尝试使用Except。
WITH
SET [TCat] AS
TopCount([Product].[Subcategory].[Subcategory],10,[Measures].[Sales Amount])
MEMBER [Product].[Subcategory].[Other] AS
Aggregate(Except( [Product].[Subcategory].[Subcategory].Members, TCat)
SELECT { [Measures].[Sales Amount] } ON COLUMNS,
Union( TCat , {[Product].[Subcategory].[Other]} ) ON ROWS
FROM [Adventure Works]