0
我想根據查詢中先前派生的總列來計算表中的百分比行。MDX百分比行不能正確計算
有兩列,然後我創建該列的總數。在下一行,我想要顯示總數的百分比。輸出應該是這樣的:
Life Non-Life (P&C) SumTotal
Premiums 66,104.44 916,792.51 982,896.95
Percentage 6.73% 93.27% 1
但相反,第二行顯示爲零。
如何構建查詢以正確計算? 下面是MDX代碼:
with member [LocationSpecificClass].[Hierarchy].[All].&[Insurance Market Statistics].[SumTotal] as SUM([LocationSpecificClass].[Hierarchy].[All].&[Insurance Market Statistics] , [Measures].[Value] )
member [LocationSpecificData].[Data Type].[All].[Percentage] as [LocationSpecificData].[Data Type].[All].[Gross Written Premiums Total - Calculated], [Measures].[Value])/([LocationSpecificClass].[Hierarchy].[All].&[Insurance Market Statistics].[SumTotal], [Measures].[Value] )
Select { [LocationSpecificClass].[Hierarchy].[All].&[Insurance Market Statistics].&[Life], [LocationSpecificClass].[Hierarchy].[All].&[Insurance Market Statistics].&[Non-Life (P&C)], [LocationSpecificClass].[Hierarchy].[All].&[Insurance Market Statistics].[SumTotal] } On Columns ,
{ [LocationSpecificData].[Data Type].[All].[Gross Written Premiums Total - Calculated] , [LocationSpecificData].[Data Type].[All].[Percentage] } On Rows
FROM [CubeDatabase]
真棒。感謝堆。 –
不客氣:)我稍微更新了'[Line2]'計算,現在是更好的解決方案。 –