Hi Peter,
The only way that I could come up with a more general solution was with
recursion, converting sets back and forth to strings. This is a sample
query on the Product dimension of Foodmart Sales (but it only partially
works):
Member [Measures].[ProductTop2Cities] AS
'iif(IsLeaf([Product].CurrentMember),
SetToStr({[Product].CurrentMember}),
SetToStr({Generate(
TOPCOUNT([Product].Children, 2, [Measures].[Unit Sales]),
StrToSet(CStr([Measures].[ProductTop2Cities]))),
Head(VisualTotals({[Product].CurrentMember,
[Product].Children - TOPCOUNT([Product].Children, 2, [Measures].[Unit
Sales])},
"* - Other")), [Product].CurrentMember}))'
SELECT {[Measures].[Unit Sales]} on columns,
StrToSet(CStr(([Measures].[ProductTop2Cities],
[Product].[All Products].[Food].[Baked Goods].[Bread]))) on rows
FROM Sales
- Deepak
Deepak Puri
Microsoft MVP - SQL Server
*** Sent via Developersdex http://www.developersdex.com ***