![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I am a new to MDX so forgive me if I am asking a simple thing. I am converting a query from existing application that used SQL to do reporting to use Analysis Services 2005. I have a database of various information about a customers. Let's say I have multiple fact tables about those customers: Fact1, Fact2 and etc. Each fact table has a different set of dimensions. I need to create a report based on the particular fact table, but need to be able to filter the customers that appear on that report based on the data from other table. So in SQL I would do something like select F1.c1,F1.c2,count(distinct F1.customer_id) from F1 join (select distinct F2.customer_id from F2 where F2.c3=768 and F2.c4= 235 ) CL1 on F1.customer_id=CL1.customer_id join (select distinct F2.customer_id from F2 where F2.c4=434 and F2.c7= 343 ) CL2 on F1.customer_id=CL2.customer_id where F1.c5=123 group by F1.c1,F1.c2 1. Is it possible to do something like that with MDX? 2. If it is possible, and I think it should be how that could be done? My own thoughts: In MDX I can't do that join so I have to create a cube that has all that data from fact tables. I created a measure group for each fact table and put a DistinctCount measure in them for customer_id. I also created a measure group for Customers and put a count of rows measure. I also established many to many relationships between all dimensions through the appropriate measure groups. What is not clear to me is how to provide the filtering of customers based on the other fact table ? I tried running following statement but results are not what I would expect. select non empty [D1].[Name].MEMBERS on 0, non empty [D2].[Name].MEMBERS on 1, Measures.Customers.Cnt on 2 from [MyCube] where ([D1].[c5].&[123], INTERSECT(EXISTS([Customer].MEMBERS,([P3].MEMBERS.&[768],[P4].MEMBERS.&[235]) ,'F2'), EXISTS([Customer].MEMBERS,([P4].MEMBERS.&[434],[P7].MEMBERS.&[343]),'F2')) Thanks. |
![]() |
| Thread Tools | |
| Display Modes | |
| |