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.
Author |
Topic |
sumit_pilankar
Starting Member
2 Posts |
Posted - 2005-11-17 : 01:51:57
|
Hi,I am new to MDX and is stuck up on a problem which i feel is quite common.We have a Cube named 'User'Measures for the cube: 1.. M1 2.. M2Dimensions for the cube: 1.. D1 2.. D2Both D1 and D2 have been created as named queries from [Date Dim] table and hence have the same number of entries and hierarchy.Requirement:We need to join A & B based on the equality of D1's member value and D2's member value.A) Select{ [Measures].[M1], [Measures].[M2] } ON COLUMNS,{ [D1].Members} ON ROWSFROM [User]B) Select{ [Measures].[M1], [Measures].[M2] } ON COLUMNS,{ [D2].Members } ON ROWSFROM [User]The corresponding SQL query which we are trying to simulate using MDX is shown below:Select Coalesce(a.si_SignupDateID, b.si_DeleteDateID) as Date, Coalesce(signupcount,0) as Registrations, Coalesce(deletedcount,0) as Deletions, (Coalesce(signupcount,0)-Coalesce(deletedcount,0)) as [Net Change]from(Select si_SignupDateID, count(*) as signupcountfrom UserFactgroup by si_SignupDateID) as a full outer join(Select si_DeleteDateID, count(*) as deletedcountfrom UserFactgroup by si_DeleteDateID) as bon a.si_SignupDateID = b.si_DeleteDateIDorder by DateThanksSumit Pilankar |
|
|
|
|
|
|