cubemember - Using Cubeset To Create Top 10 Items List For a Specified Time Period





how tutorial (2)


You could try something like this

=CUBESET($M$1,
     "TopCount(
       [Product].[Brand].Children,
       10,
       Sum(
            (
                [Time].[Calendar].[Calendar Month].&[2011]&[8],
                [Customer].[Is Internal].&[False],
                [Customer].[Type].&[CAT]
            ),
         [Measures].[Revenue]
       )
     )",
     "Top 10 Brands"
)

I am using Excel 2010 to create a list of the top 10 vendors by sales during a specified time period. The catch is that I need to consider only customers that are a member of a particular set. I found this article which has helped me get the Top 10 vendors for sales from all customers, but I'm struggling with how to sum only over the members of a particular set. I tried the Sum/CrossJoin example that is further down the page in the comments, but I was unable to get it to work. It could be that I'm pretty new at this and just don't understand which pieces need to go where. Here is what I have so far (my connection name is in cell M1):


All Customers (works perfectly):

=CUBESET($M$1,
         "TopCount(
           [Product].[Brand].Children,
           10,
           Sum(
             [Time].[Calendar].[Calendar Month].&[2011]&[8],
             [Measures].[Revenue]
           )
         )",
         "Top 10 Brands"
)


Subset of Customers (appears to return correct set):

=CUBESET($M$1,
         "Intersect(
           Intersect(
             exists(
               [Customer].[Cust Num].Members,
               {[Customer].[Is Internal].&[False],[Customer].[Is Internal].[All].UNKNOWNMEMBER}
             ),
             exists(
               [Customer].[Cust Num].Members,
               [Customer].[Type].&[CAT]
             ),
             ALL
           ),
           exists(
             [Customer].[Cust Num].Members,
             [Market].[Market ID].[All].Children - [Market].[Market ID].&[3] - [Market].[Market ID].&[4]
           ),
           ALL
         )",
         "Cust Group"
)



Any help and/or guidance would be greatly appreciated.....thanks in advance!




In the worksheet module for the sheet containing the list:

Private Sub Worksheet_Change(ByVal Target As Range)

    Dim rngDest As Range

    If Not Intersect(Target, Me.Columns(1)) Is Nothing Then

        Set rngDest = ThisWorkbook.Sheets("Sheet2").Range("A1")

        Me.Range(Me.Range("A2"), Me.Cells(Rows.Count, 1).End(xlUp)).AdvancedFilter _
            Action:=xlFilterCopy, CopyToRange:=rngDest, Unique:=True

    End If

End Sub