![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| ||||
| ||||
|
|
Is it possible to do sub-MX as one can do in SQL? Yes, it is. the following shows you how you can nest SELECT statements: |
| SELECT subcube clause> ::= |
|
Is it possible to do sub-MX as one can do in SQL? E.g. selecting a subset of customers who did a specific kind of transaction, and then query other issues on these customers. An SQL example could be: SELECT sum(time_spent) FROM tbl_transaction WHERE customer_id IN (SELECT customer_id FROM tbl_transaction WHERE type=' ABC') i.e. doing the aggregate on all transation time spent for these customers, and not only where they did the 'ABC' type of transaction. How is this done in MDX. A splice seems not to do the trick. My scope is AS2005 Thanks JE |
#3
| |||
| |||
|
#4
| |||
| |||
|
| WITH |
|
Thanks but, I believe that Darrens suggestion is not the correct solution. Please try to review the concept of the supplied SQL. It is very important to note that a customer can do more than one transaction, and that it selects customers based on a single type of transaction, but it aggregates on ALL transactions made by these customers, not only the specific type. Darrens MDX will, as far as I can see, create a sub cube with only those transactions that fulfil the transaction type filter. Thus the result would be quite different from what the SQL returns. /JE |
#5
| |||
| |||
|
#6
| |||
| |||
|
|
Getting a great deal closer. Would that be the AdventureWorks or AdventureWorksDW base? Your query does not return anything on DW and we cant build the other one (I was not told why). /JE It is the [Adventure Works] cube in the [Adventure Works DW] Olap |
#7
| |||
| |||
|
#8
| |||
| |||
|
|
Same cube, then I am puzzled by the zero output! Anyway, I can't supply you with any MDX, as we are just getting started to learn the syntax here. But I could give you an expected output from the Adventure Works setup. Say that we replicate the product dimension, then having two of these around the internet_sales fact table. Then I would like the following output, where I count customers buying product combinations, but ONLY if they once or more have bought product A. The output example is a symmetric 3x3 matrix, shown here un-pivoted for clearness: Product; Product; Customer count ------------------------------------ A; A; 4 A; B; 2 A; C; 1 B; A; 2 B; B; 6 B; C; 2 C; A; 1 C; B; 2 C; C; 5 I am aware of that this extends the question a bit! /JE |
![]() |
| Thread Tools | |
| Display Modes | |
| |