Using aggregation with TopCount (PLEASE HELP!) -
10-14-2004
, 08:41 AM
I am trying to get subtotaling and totaling by dimension as well as
trying to apply ranking. I want the totaling to only include what
meets the ranking filter. I can seem to do it. I have tried the
following MDX. The subtotal line is corrent and the very last total
line is correct. But, the totaling in the "TOTAL" level of DATE is
wrong. Help!!!!
WITH
set [a] as 'nonemptyCROSSJOIN([CARS].[CAR].MEMBERS,[DATE].[DTE].MEMBERS)'
set [b] as 'ORDER({a}, ([Measures].[SALES_SUM]), DESC)'
set [c] as 'TopCount([b], 10, [Measures].[SALES_SUM])'
SET [Ca] AS '[CARS].[CAR].MEMBERS'
MEMBER [CARS].[All CARS].[SubTotal] AS 'AGGREGATE([ca])'
SET [CarsTOTAL ] AS '{[cars].[All CARS].[SubTotal]}'
SET [aa] AS '{[CA], [CarsTOTAL ]}'
SET [Da] AS '[DATE].[DTE].MEMBERS'
MEMBER [DATE].[All DATE].[Total] AS 'AGGREGATE([c])'
SET [DateTOTAL ] AS '{[DATE].[All DATE].[Total]}'
set [bb] as '{[da],[datetotal ]}'
set [rows] as 'nonemptyCROSSJOIN([bb],[aa])'
SELECT ({[Measures].[SALES_SUM]}) ON COLUMNS, [rows] ON ROWS FROM
MDDBCARS |