Selecting children of a range using the colon operator

  • I need to select the children of a range of parents. For example, I want all the products in the categories [ProductCategory].[All ProductCategory].[Juice]:[ProductCategory].[All ProductCategory].[Water]

    I've tried adding a few combinations of .Children to the query:

    [ProductCategory].[All ProductCategory].[Juice].Children:[ProductCategory].[All ProductCategory].[Water].Children

    {[ProductCategory].[All ProductCategory].[Juice]:[ProductCategory].[All ProductCategory].[Water]}.Children

    All my efforts return syntax errors.

    How can I achieve this?

  • I'm thinking that maybe use of the GENERATE function in conjunction with something like DESCENDANTS could give you what you want.  Along the lines of GENERATE([ProdCat].[blah01]:[ProdCat].[Blah99], DESCENDANTS([ProdCat].CURRENTMEMBER, [ProdCat].[SubCat]))  The idea being that the generate will use the results of the first set (blah01 through blah99) and then iterate through these with the descendants function (so it uses the currentmember / iterator in that first set) and then selects the descendants at the appropriate level (i've mocked out the product subcategory level) for that currentmember/iterator.

    For a much clearer example, check out Bill Pearsons walkthrough here.

    HTH,

     

    Steve.

  • Great, that worked a treat. Thanks!

    Sam

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply