的MDX Qyery工作正常,爲一年的表現,我們怎麼可以運行相同的查詢,兩年來性能的MDX Qyery做工精細的一年,我們如何可以運行相同的查詢,兩年來
WITH
MEMBER [Measures].[Metric] AS Round(sum(({[Year].[Year].&[2015]}),[Measures].[PurchaseSum]),2)
SET CustYear as exists([DIMCustomer].[Level 02].allmembers,({[Year].[Year].&[2015]}),"sales")
SET [BusinessSet] AS { filter((
EXISTS(CustYear, [DIMCustomer].[HierarchyCategory].&[UnitHierarchy],"sales")
),([Measures].[Metric] or [Measures].[Metric]=0))}
SET [SellerFilterCustomerID] AS EXISTS([DIMSeller].[CustId].ALLMEMBERS,{[DIMSeller].[CustId].[All]}, "sales")
SET [SellerFilterCustomerType] AS EXISTS([DIMSeller].[CustId].ALLMEMBERS,[DIMSeller].[CustomerType].[All])
SET [SellerFilterCompanyName] AS EXISTS([DIMSeller].[CustId].ALLMEMBERS,{[DIMSeller].[Name].[All]}, "sales")
SET [SellerFilterCompanyLoc] AS EXISTS([DIMSeller].[CustId].ALLMEMBERS,[DIMSeller].[Organization].[All])
SET [FinalSellerFilter] as (intersect(intersect(intersect([SellerFilterCustomerID],[SellerFilterCustomerType]),[SellerFilterCompanyName]),[SellerFilterCompanyLoc]))
SET Name AS {[DIMCustomer].[Name].[All]}
SET Code AS {[DIMCustomer].[Code].[All]}
SET CustType AS {[DIMCustomer].[CustomerType].[All]}
SET OrgLoc AS {[DIMCustomer].[Organization].[All]}
SET CustFilters AS (Name,Code,CustType,OrgLoc)
SET ICP as {{[DimProduct].[ICP].[All]}}
SET ProdICP as (ICP)
//creating year filter
SET CrYear as {[Year].[Year].&[2015]}
SET Others AS (CrYear,ProdICP)
SET [SalesSet] AS exists([BusinessSet],[FinalSellerFilter],"sales")
//creating final set
SET FINALSET as exists([SalesSet],CustFilters,"sales")
SET Geo as exists([DIMCustomer].[ParentPostalNumber].[ParentPostalNumber],({[Year].[Year].&[2015]}),"sales")
SET [FIPS] AS Except(EXISTS(Geo,[SalesSet], "sales"),{[DIMCustomer].[ParentPostalNumber].&[0],[DIMCustomer].[ParentPostalNumber].&[]})
MEMBER [Measures].[Sales] AS round(sum(([FINALSET],Others),[Measures].[Metric]),2)
MEMBER [Measures].[Count] as (exists(([FINALSET],Others,[SalesType].[SalesType].&[3]),[DIMCustomer].[ParentPostalNumber].currentmember, "sales")).count
SELECT
non empty {
[Measures].[Sales],[Measures].[Count]
} ON 0,
NON EMPTY{
FIPS
} ON 1
FROM [cube]**
我們確實需要更全面的解釋。 – whytheq
這是ONE BIG MESSED UP查詢!幾件事情。 1.儘可能避免命名集。嘗試推算計算以創建'MEMBER'。 2.儘可能嘗試使用「NonEmpty」。 3.除非確實需要,否則請儘量避免使用「非空」。 4.擺脫腳本中最終查詢中未使用的集合。我還無法理解「EXISTS([DIMSeller]。[CustId] .ALLMEMBERS,{[DIMSeller]。[Name]。[All]},」sales「)''背後的原因。你爲什麼要這樣做? – SouravA