Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Analysis Server and Reporting Services (2008)
 MDX::SUM only unique combinations of columns

Author  Topic 

m14cus
Starting Member

2 Posts

Posted - 2010-09-30 : 13:45:29
I have a table that contains order data and I'm trying to return the sum of 'ORDER_TOT' . I've tried to use distinct(ORDER_TOT) but it stil sums up all the ord_tot for each order_num. i.e returns 15 and not 5

I'm new to MDX and although found a few similar examples I can't find an answer.

Any help would be very gratefully received

Example Data

ORDER_NUM SKU ITEM_AMT ORDER_TOT
001 ABC123 1.00 5.00
001 CDE001 2.50 5.00
001 FGH003 1.50 5.00

Example code I've tried

SELECT
[Measures].[Order Total Amount]
ON COLUMNS
,NON EMPTY
[OrderNumber].[Order Number].MEMBERS ON ROWS
FROM
TJX



SELECT
distinct([Measures].[Order Total Amount])
ON COLUMNS
,NON EMPTY
[OrderNumber].[Order Number].MEMBERS ON ROWS
FROM
TJX
   

- Advertisement -