2015-10-06 106 views
0

我有以下查詢,其中計算的度量TotalPNLPercent顯示了個別基金的百分比pnl。如何將度量聚合限制爲計算成員中的單個維度

With 
Member [Measures].[Fund_NAV] as 
([Measures].[NAV_Calculated_IncludingAccruals_CurrentDay],[Fact PNL Data].[Fund].CurrentMember) 

Member [Measures].[TotalPNLPercent] 
as (
Case 
    when isempty([Measures].[Fund_NAV]) or [Measures].[Fund_NAV] = 0 
    then 0 
    else 
    ([Measures].[Total MTM PNL]/[Measures].[Fund_NAV])*100 
End 
) 
select 
non empty 
{ 
    [Measures].[TotalPNLPercent], 
    [Measures].[Total MTM PNL], 
    [Measures].[Fund_NAV] 
} on 0, 
non empty 
{ 
    [Fact PNL Data].[Fund].[Fund].Members * 
// [Fact PNL Data].[Asset].[Asset].Members* 
    [Fact PNL Data].[Rundate].&[2015-02-11T00:00:00] 
} on 1 
from 
[DSV_NirvanaClientDW] 

當我也把資產尺寸在行軸,[措施]。[Fund_NAV]進一步分割基於單個基金中存在的資產的數量。我想要的是[措施]。[Fund_NAV]除了資金之外不應該分裂。如果fund1有3個資產,那麼相同的[度量]。[Fund_NAV]應該出現在對應於fund1和3個不同行的資產中。 當前行爲是完全合乎邏輯的,因爲事實表與基金和資產維度都有關。我不想刪除事實表和資產之間的關係。 有沒有什麼方法可以限制[度量] [Fund_NAV]計算度量到基金維度的彙總?

+0

一張照片可以說他們說的千言萬語...... – SouravA

回答

0

如果我理解正確,你需要稍微調整一下calcualted成員的定義。

With 
Member [Measures].[Fund_NAV] as 
(
    [Measures].[NAV_Calculated_IncludingAccruals_CurrentDay], 
    [Fact PNL Data].[Fund].CurrentMember, 
    [Fact PNL Data].[Asset].[All] 
) 

添加[All]成員明確將從[Fact PNL Data].[Asset]層次覆蓋到當前成員的隱式引用。

相關問題