![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
| display cumulative sum of members in a level |
#3
| |||
| |||
|
|
This earlier post on the newsgroup includes a sample Adventure Works query, where the Top 2 products and others are spearately listed at multiple levels: http://groups.google.com/group/micro...olap/msg/98796 b1abded3dec display cumulative sum of members in a level .. The updated query for Adventure Works is: WITH Member [Measures].[ProductTop2] AS 'iif(IsLeaf([Product].[Product Categories].CurrentMember), SetToStr({[Product].[Product Categories].CurrentMember}), SetToStr( Generate(TOPCOUNT([Product].[Product Categories].Children, 2, [Measures].[Sales Amount]), StrToSet(CStr([Measures].[ProductTop2]))) + Head(VisualTotals({[Product].[Product Categories].CurrentMember, [Product].[Product Categories].Children - TOPCOUNT([Product].[Product Categories].Children, 2, [Measures].[Sales Amount])}, "* - Other"))))' SELECT {[Measures].[Sales Amount]} on columns, StrToSet(CStr(([Measures].[ProductTop2], [Product].[Product Categories].[All Products]))) on rows FROM [Adventure Works] -------------------------------------------------------- Sales Amount Road-150 Red, 56 $1,847,818.63 Road-350-W Yellow, 48 $1,774,883.56 Road Bikes - Other $40,256,088.81 Mountain-200 Black, 38 $2,589,363.78 Mountain-200 Black, 42 $2,265,485.38 Mountain Bikes - Other $31,590,594.78 Bikes - Other $14,296,291.27 HL Mountain Frame - Silver, 38 $412,969.20 HL Mountain Frame - Black, 42 $395,972.64 Mountain Frames - Other $3,904,730.31 ML Road Frame-W - Yellow, 44 $255,122.13 ML Road Frame-W - Yellow, 44 $230,578.41 Road Frames - Other $3,364,152.80 Components - Other $3,235,551.17 All Products - Other $3,389,671.34 - Deepak Deepak Puri Microsoft MVP - SQL Server *** Sent via Developersdex http://www.developersdex.com *** |
#4
| |||
| |||
|
|
I have a problem the result is France Paris 11 Lyon 9 Marse 8 Others 23 All Other 50 But no Canada Toronto 8 Montreal 7 Vancouver 5 Others 29 Deepak Puri ha escrito: This earlier post on the newsgroup includes a sample Adventure Works query, where the Top 2 products and others are spearately listed at multiple levels: http://groups.google.com/group/micro...olap/msg/98796 b1abded3dec display cumulative sum of members in a level .. The updated query for Adventure Works is: WITH Member [Measures].[ProductTop2] AS 'iif(IsLeaf([Product].[Product Categories].CurrentMember), SetToStr({[Product].[Product Categories].CurrentMember}), SetToStr( Generate(TOPCOUNT([Product].[Product Categories].Children, 2, [Measures].[Sales Amount]), StrToSet(CStr([Measures].[ProductTop2]))) + Head(VisualTotals({[Product].[Product Categories].CurrentMember, [Product].[Product Categories].Children - TOPCOUNT([Product].[Product Categories].Children, 2, [Measures].[Sales Amount])}, "* - Other"))))' SELECT {[Measures].[Sales Amount]} on columns, StrToSet(CStr(([Measures].[ProductTop2], [Product].[Product Categories].[All Products]))) on rows FROM [Adventure Works] -------------------------------------------------------- Sales Amount Road-150 Red, 56 $1,847,818.63 Road-350-W Yellow, 48 $1,774,883.56 Road Bikes - Other $40,256,088.81 Mountain-200 Black, 38 $2,589,363.78 Mountain-200 Black, 42 $2,265,485.38 Mountain Bikes - Other $31,590,594.78 Bikes - Other $14,296,291.27 HL Mountain Frame - Silver, 38 $412,969.20 HL Mountain Frame - Black, 42 $395,972.64 Mountain Frames - Other $3,904,730.31 ML Road Frame-W - Yellow, 44 $255,122.13 ML Road Frame-W - Yellow, 44 $230,578.41 Road Frames - Other $3,364,152.80 Components - Other $3,235,551.17 All Products - Other $3,389,671.34 - Deepak Deepak Puri Microsoft MVP - SQL Server *** Sent via Developersdex http://www.developersdex.com *** |
![]() |
| Thread Tools | |
| Display Modes | |
| |