• Hello Ken.

    If your intention is to query a cube then Mdx is your query-language. MDX has a built-in Median function you can use. The following (MDX) query results in the medium value for the internet sales count-measure based on the cutomer education.

    with member [measures].[median internet sales count] as

    MEDIAN( [Dim Customer].[Education].[Education].members ,[Measures].[Internet Sales Count] )

    select {[measures].[median internet sales count]} on 0

    from [Adventure Works DW]

    The outcome of this query is:

    median internet sales count

    10603

    By querying the measure Internet Sales Count by Customer Education we can validate that the median has been caluculated correctly.

    select {[Measures].[Internet Sales Count]} on 0,

    order([Dim Customer].[Education].[Education].members, [Measures].[Internet Sales Count], asc) on 1

    from [Adventure Works DW]

    which results in:

    Internet Sales Count

    Partial High School4,708

    High School10,320

    Graduate Degree10,603

    Partial College16,623

    Bachelors18,144

    QED

    Hope this helps you out.

    Cees