【问题标题】:Addition and substraction Ok, but not Division加减法可以,但不能除法
【发布时间】:2016-02-11 13:59:18
【问题描述】:

使用以下 Calc 成员:

create calculated member [NbJoursNonAmbuTemp] as 
   sum([Ambu].[Ambu].[Ambu].[Non Ambulatoire], [Nombre de Journées])
create calculated member [NbJoursNonAmbuFinal] as 
    IIF( [Ambu].[Ambu].current is [Ambu].[Ambu].[Ambulatoire], 0, divN([NbJoursNonAmbuTemp], 1 , null)   )
create calculated member [NbSejoursNonAmbuTemp] as 
    sum([Ambu].[Ambu].[Ambu].[Non Ambulatoire], [NbSejours])
create calculated member [NbSejoursNonAmbuFinal] as 
    IIF( [Ambu].[Ambu].current is [Ambu].[Ambu].[Ambulatoire], 0, divN([NbSejoursNonAmbuTemp], 1 , null)   )

以下 MDX :

WITH 
  MEMBER toto AS 
    Sum
    (
      CrossJoin
      (
        Descendants
        (
          [Classification GHM].[DA_GP_GA_GHM].CurrentMember
         ,[Classification GHM].[DA_GP_GA_GHM].[GHM]
         ,SELF
        )
       ,Descendants
        (
          [Periode].[Periode].CurrentMember
         ,[Periode].[Periode].[Année-L]
         ,SELF
        )
      )
     ,
        [Measures].[NbSejoursNonAmbuFinal] * [Measures].[dsmFrance]
      / 
        [Measures].[NbJoursNonAmbuFinal]
    ) 
SELECT 
  {
    toto
   ,[Measures].[NbJoursNonAmbuFinal]
  } ON 0
 ,[Classification GHM].[DA_GP_GA_GHM].[All-M] ON 1
FROM [Cube]
WHERE 
    {
      [Etablissement].[Lieu établissement].[Etablissement-L].&[720016724]
    }
  * 
    {[Periode].[Periode].[Année-L].[2014]};

没有给出toto的预期值...

但如果不是(除法)

,([Measures].[NbSejoursNonAmbuFinal] * [Measures].[dsmFrance]) / [Measures].[NbJoursNonAmbuFinal]

我试试(加法)

,([Measures].[NbSejoursNonAmbuFinal] * [Measures].[dsmFrance]) + [Measures].[NbJoursNonAmbuFinal]

或(减法)

,([Measures].[NbSejoursNonAmbuFinal] * [Measures].[dsmFrance]) - [Measures].[NbJoursNonAmbuFinal]

一切都计算正确...

我做错了什么?

发送给@whytheq 的建议,我成功地使用了:

WITH 
  MEMBER HospidiagWIP AS 
    Sum
    (
      CrossJoin
      (
        Descendants
        (
          [Classification GHM].[DA_GP_GA_GHM].CurrentMember
         ,[Classification GHM].[DA_GP_GA_GHM].[GHM]
         ,SELF
        )
       ,Descendants
        (
          [Periode].[Periode].CurrentMember
         ,[Periode].[Periode].[Année-L]
         ,SELF
        )
      )
     ,
      [Measures].[NbSejoursNonAmbuFinal] * [Measures].[dsmFrance]
    ) 
    MEMBER [Measures].[IPDMS HospidiagTest] as HospidiagWIP / [Measures].[NbJoursNonAmbuFinal]  , format_string='0.000'
SELECT 
  {
   [Measures].[IPDMS HospidiagTest]
   ,[Measures].[IPDMS]
  } ON 0
 ,[Classification GHM].[DA_GP_GA_GHM].[All-M] ON 1
 // ,{[Classification GHM].[DA_GP_GA_GHM].[All-M]} * {[Periode].[Periode].[Année-L].[2013], [Periode].[Periode].[Année-L].[2014]} ON 1

FROM [Cube]
WHERE 
    {
      [Etablissement].[Lieu établissement].[Etablissement-L].&[720016724]
    }
  * 
    {[Periode].[Periode].[Année-L].[2014]}

【问题讨论】:

    标签: mdx iccube


    【解决方案1】:

    尝试以下方法并检查结果 - 是否有助于分析引擎在做什么?

    尝试执行解决命令。

    WITH 
      MEMBER PREtoto AS
            [Measures].[NbSejoursNonAmbuFinal] * [Measures].[dsmFrance]
          / 
            [Measures].[NbJoursNonAmbuFinal]
         ,SOLVE_ORDER = 1
      MEMBER toto AS 
        Sum
        (
          CrossJoin
          (
            Descendants
            (
              [Classification GHM].[DA_GP_GA_GHM].CurrentMember
             ,[Classification GHM].[DA_GP_GA_GHM].[GHM]
             ,SELF
            )
           ,Descendants
            (
              [Periode].[Periode].CurrentMember
             ,[Periode].[Periode].[Année-L]
             ,SELF
            )
          )
         ,
          PREtoto
        ) 
        ,SOLVE_ORDER = 2   //<<or try the other way by changing to -1
    SELECT 
      {
        PREtoto
       ,toto
       ,[Measures].[NbJoursNonAmbuFinal]
      } ON 0
     ,[Classification GHM].[DA_GP_GA_GHM].[All-M] ON 1
    FROM [Cube]
    WHERE 
        {
          [Etablissement].[Lieu établissement].[Etablissement-L].&[720016724]
        }
      * 
        {[Periode].[Periode].[Année-L].[2014]};
    

    【讨论】:

    • 感谢您的建议,我取得了不错的成绩...我将其发布在主要问题中。
    • 我很高兴你一切顺利。
    猜你喜欢
    • 2012-08-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-10-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多