Here is an example similar to your situation against AdvWrks
:
WITH
SET [AllCountries] AS [Country].[Country].MEMBERS
SET [AllStates] AS [State-Province].[State-Province].MEMBERS
SET [Top2States] AS
Generate
(
[AllCountries]
,TopCount
(
(EXISTING
[AllStates])
,3
,[Measures].[Internet Order Count]
)
)
MEMBER [State-Province].[All].[RestOfCountry] AS
Aggregate({(EXISTING {[AllStates]} - [Top2States])})
SELECT
{[Measures].[Internet Order Count]} ON COLUMNS
,{
[AllCountries]
*
{
[Top2States]
,[State-Province].[All].[RestOfCountry]
,[State-Province].[All]
}
} ON ROWS
FROM [Adventure Works];
It gives these results:
So if I attempt to adapt the above and simplify it, as you do not require a RestOf..
category I get something like this:
WITH
SET [AllCities] AS [Markets].[City].MEMBERS
//SET [AllPRODUCTS] AS NONEMPTY([Product].[Product].MEMBERS, [Measures].[Sales])
//alternative if NonEmpty not implemented in Mondrian..
SET [AllPRODUCTS] AS
FILTER(
[Product].[Product].MEMBERS
,not isEmpty([Measures].[Sales])
)
SET [Top5PRODUCTS] AS
Generate
(
[AllCities]
,TopCount
(
(EXISTING
[AllPRODUCTS])
,5
,[Measures].[Sales]
)
)
SELECT
NON EMPTY
{[Measures].[Sales]} ON COLUMNS
,
[AllCities]
*[Top5PRODUCTS]
ON ROWS
FROM [SteelWheelsSales];
ORDER
in Mondrian? – ps0604