grouping by MDX

  • i want count the number of costumer by age group, by store and date (of course that is implicit that the costumers has sales...)

    in my date base i have the following data:

    costumers code| age group | store | date | sales

    1 | 0-14 | 4 | 20-7-2010 | 10

    2 | 0-14 | 4 | 20-7-2010 | 5

    3 | 15-24 | 5 | 21-7-2010 | 0

    i want simply count the numbers of costumer for a given age group, store and date:

    Suppose:

    for store 4, and day 20-7-2010 , how many costumers for age group 0-14 there are?

    for this age group are: 2

    correct?

    thanks

  • Is your [Dim Costumer] dimension connected to a measure group containing Sales? Then you can use the following statement assuming your measure name is called Sales:

    WITH

    SET FilteredSet AS

    nonempty(

    [Dim Costumer].[Cod].ALLMEMBERS *

    [Dim Costumer].[Age Group].&[0-14] *

    [Dim Store].[Cod].&[51] *

    [Dim Date].[D].&[2010-07-21],

    [Measures].[Sales]

    )

    MEMBER [Measures].[x] AS Count(FilteredSet)

    SELECT {[Measures].[x]} ON 0,

    FilteredSet ON 1

    FROM [StoreDM];

  • sorry but it return the following error :

    "the measures hierarchy already appears in the Axis0 axis."

    thanks

  • then you should put another hierarchy on the rows axis. I just put the filteredset on that axis as an example

  • hi!

    ok! it count, but it is not accurate... i don't figure out why.... ! but i will do it...for sure!

    i want thanks to all that answer to my post in this great forum! thanks to you all! and also to Steve Jones...

Viewing 5 posts - 16 through 19 (of 19 total)

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