Hi All,I would like to know how to get the sum in MDX Query for the below T-sql query . I took Example of all these tables from 'AdventureWorksDW2012' Database. select sum(SalesAmountQuota) from DimCustomer cinner join FactInternetSales fison c.CustomerKey = fis.CustomerKeyinner join DimDate don fis.OrderDateKey = d.DateKeyinner join FactSalesQuota fsqon fsq.DateKey = d.DateKeyinner join DimEmployee eon e.EmployeeKey = fsq.EmployeeKeywhere c.CustomerKey = 11003Table - DimCustomerCustomerKey GeographyKey CustomerAlternateKey Title FirstName MiddleName LastName------------------------------------------------------------------------------------------------------------------------------------------------11003 11 AW00011003 NULL Christy NULL ZhuTable - FactInternetSales ProductKey OrderDateKey DueDateKey ShipDateKey CustomerKey----------------------------------------------------------------------------------------------------346 20050701 20050713 20050708 11003344 20051001 20051013 20051008 11003361 20070709 20070721 20070716 11003478 20070709 20070721 20070716 11003477 20070709 20070721 20070716 11003225 20070709 20070721 20070716 11003564 20071111 20071123 20071118 11003541 20071111 20071123 20071118 11003530 20071111 20071123 20071118 11003480 20071111 20071123 20071118 11003Table - DimDateDateKey FullDateAlternateKey DayNumberOfWeek---------------------------------------------------------------------20050701 2005-07-01 620051001 2005-10-01 7Table - FactSalesQuotaSalesQuotaKey EmployeeKey DateKey CalendarYear CalendarQuarter SalesAmountQuota-----------------------------------------------------------------------------------------------------------------------1 272 20050701 2005 3 28000.002 281 20050701 2005 3 367000.003 282 20050701 2005 3 637000.004 283 20050701 2005 3 565000.005 284 20050701 2005 3 244000.006 285 20050701 2005 3 669000.007 286 20051001 2005 3 165000.008 287 20050701 2005 3 460000.009 288 20050701 2005 3 525000.0010 289 20050701 2005 3 226000.0011 272 20051001 2005 4 7000.0012 281 20051001 2005 4 556000.0013 282 20051001 2005 4 781000.0014 283 20051001 2005 4 872000.0015 284 20051001 2005 4 356000.0016 285 20051001 2005 4 917000.0017 286 20051001 2005 4 469000.0018 287 20051001 2005 4 549000.0019 288 20051001 2005 4 767000.0020 289 20051001 2005 4 353000.00Table - DimEmployeedEmployeeKey ParentEmployeeKey-----------------------------------------------------------------------------------------------------281 272282 272283 272284 272285 272286 272287 272288 272289 272293 272I want to write a mdx query to get my total as 9513000 from cube. When I created a cube with many to many relationship, I get below result SELECT NON EMPTY { [Measures].[Sales Amount Quota] } ON COLUMNS, NON EMPTY { ([Dim Customer].[Customer Key].[Customer Key].ALLMEMBERS * [Dim Date].[Date Key].[Date Key].ALLMEMBERS ) } ON ROWS FROM ( SELECT ( { [Dim Customer].[Customer Key].&[11003] } ) ON COLUMNS FROM [AWDW20112withManytoMany]) Result - Sales Amount Quota--------------------------------------------11003 20050701 372100011003 20051001 5792000But, how to get value of 9513000 for customer key -11003 . Thought it easy for me in tsql but mdx is getting tough for me. Any help on this would be really great.
↧