如何使用 MDX 获取百分比

How to get the Percentage using MDX

我想在 运行 时间内找到索赔百分比。
我了解到可以使用计算的度量来实现,但我不知道该怎么做。请指导我如何找到索赔百分比((line count/grandtotoal) *100).

你可以适应并试试这个:

WITH 
   MEMBER [Measures].[Percentage] AS
   [Measures].[line count]/
   ([Measures].[grandtotoal]), 
   FORMAT_STRING = 'Percent';
SELECT 
{[Measures].[Percentage]} ON COLUMNS, 
FROM [yourcube]

尝试如下操作:

WITH 
   MEMBER [Measures].[PercentageOfAll] AS
       [Tmp Claim Dim].[Claimno].CURRENTMEMBER
       /
      ([Tmp Claim Dim].[Claimno].[All])
   ,FORMAT_STRING = 'Percent';
SELECT 
    {[Measures].[Tmp Claim Dim Count],
     [Measures].[PercentageOfAll]} ON 0,
     [Tmp Claim Dim].[Claimno].MEMBERS ON 1 
FROM [ACOE PI];

如果您希望以上仅适用于度量 [Tmp Claim Dim Count],那么您可以在新度量中使用元组和此度量:

WITH 
   MEMBER [Measures].[PercentageOfAll_ClaimCnt] AS
      ([Tmp Claim Dim].[Claimno].CURRENTMEMBER, [Measures].[Tmp Claim Dim Count])
       /
      ([Tmp Claim Dim].[Claimno].[All], [Measures].[Tmp Claim Dim Count]) 
   ,FORMAT_STRING = 'Percent';
SELECT 
    {[Measures].[Tmp Claim Dim Count]} ON 0,
     [Tmp Claim Dim].[Claimno].MEMBERS ON 1 
FROM [ACOE PI];