![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
| WITH |
#3
| |||
| |||
|
|
Using NonEmptyCrossJoin() when ranking seems to reduce query time by about 50% (still slow, though). That may be because each customer falls into just 1 of 2 genders: WITH SET [RowSet0] AS '{[Product].[All Products].[Drink],[Product].[All Products].[Food]}' SET [RowSet1] AS 'Descendants([Customers].[All Customers].[USA])' SET [ColumnSet0] AS '{[Gender].[All Gender].[F],[Gender].[All Gender].[M]}' SET [ColumnSet1] AS '{[Measures].[Store Cost],[Measures].[Store Sales]}' MEMBER [Measures].[Rank0] AS 'iif(IsEmpty([Measures].[Store Cost]), NonEmptyCrossJoin([RowSet1], {[Product].CurrentMember}, {[Gender].CurrentMember}, 1).Count + 1, Rank([Customers].CurrentMember, Order( NonEmptyCrossJoin([RowSet1], {[Product].CurrentMember}, {[Gender].CurrentMember}, 1), [Measures].[Store Cost],BDESC)))' MEMBER [Measures].[Rank1] AS 'iif(IsEmpty([Measures].[Store Sales]), NonEmptyCrossJoin([RowSet1], {[Product].CurrentMember}, {[Gender].CurrentMember}, 1).Count + 1, Rank([Customers].CurrentMember, Order( NonEmptyCrossJoin([RowSet1], {[Product].CurrentMember}, {[Gender].CurrentMember}, 1), [Measures].[Store Sales],BDESC)))' SET [RankSet] AS '{Subset([ColumnSet1],0,1),[Measures].[Rank0],Subset([ColumnSet1],1,1), [Measures].[Rank1],Subset([ColumnSet1],2)}' SET [RowSet] AS '[RowSet0] * [RowSet1]' SET [ColumnSet] AS '[ColumnSet0] * [RankSet]' SELECT Subset([RowSet], 0, 100) ON ROWS, [ColumnSet] ON COLUMNS FROM [Sales] - Deepak *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
#4
| |||
| |||
|
#5
| |||
| |||
|
|
I'm puzzled by why TopCount(), as you used it, would out-perform Order(), since it's ordering the same number of members - doing the same thing. |
|
Hi Stan, Interesting question about whether the ranking sets can be cached - I haven't done something similar so far, but maybe others on the newsgroup have? I'm puzzled by why TopCount(), as you used it, would out-perform Order(), since it's ordering the same number of members - doing the same thing. When dealing with calculated measures, it's sometimes still possible to use NonEmptyCrossJoin() for filtering. For example, if there is a calculated average that is null whenever a base sum measure is, then NECJ() can be used to filter out tuples of a set that have a null average. - Deepak *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
#6
| |||
| |||
|
#7
| |||
| |||
|
| WITH |
#8
| |||
| |||
|
|
'TopCount([RowSet0],Count([RowSet0]), ([Measures].[Store Cost]))' |
![]() |
| Thread Tools | |
| Display Modes | |
| |