在度量上获取NULL

时间:2017-07-14 13:37:13

标签: reporting-services ssas mdx

我有这个针对SSRS数据集的MDX查询,并且我在所有度量上得到Nulls,任何线索?

WITH 
MEMBER  [Measures].[CA TTC PC] 
as ( STRTOMEMBER(@FromAxeTempsTemps2) : STRTOMEMBER(@ToAxeTempsTemps2), 
 [Axe Scenario].[Scenario].&[Réalisé]
,  [Measures].[CA TTC] )
MEMBER  [Measures].[CA HT PC] 
as ( STRTOMEMBER(@FromAxeTempsTemps2) : STRTOMEMBER(@ToAxeTempsTemps2), 
 [Axe Scenario].[Scenario].&[Réalisé]
,  [Measures].[CA HT] )
MEMBER  [Measures].[Marge PC] 
as ( STRTOMEMBER(@FromAxeTempsTemps2) : STRTOMEMBER(@ToAxeTempsTemps2),
 [Axe Scenario].[Scenario].&[Réalisé]
,  [Measures].[Marge] )
MEMBER  [Measures].[TauxMarge PC] 
as ( STRTOMEMBER(@FromAxeTempsTemps2) : STRTOMEMBER(@ToAxeTempsTemps2),
 [Axe Scenario].[Scenario].&[Réalisé]
,  [Measures].[Taux Marge] )
MEMBER  [Measures].[Quantite Vendue PC] 
as ( STRTOMEMBER(@FromAxeTempsTemps2) : STRTOMEMBER(@ToAxeTempsTemps2),
 [Axe Scenario].[Scenario].&[Réalisé]
,  [Measures].[Quantite Vendue] )
MEMBER  [Measures].[Nbr De Tickets PC] 
as ( STRTOMEMBER(@FromAxeTempsTemps2) : STRTOMEMBER(@ToAxeTempsTemps2)
, [Measures].[Nombre De Tickets] )
SELECT 
{ [Measures].[CA HT], 
[Measures].[CA TTC],
 [Measures].[Marge], [Measures].[Taux Marge] ,
[Measures].[Nombre Tickets],[Measures].[Marge PC] 
, [Measures].[Quantite Vendue], [Measures].[CA TTC PC] ,
  [Measures].[TauxMarge PC] , [Measures].[Quantite Vendue PC] ,
 [Measures].[Nbr De Tickets PC] ,[Measures].[Nombre De Tickets] 
,[Measures].[CA HT PC] 
} ON COLUMNS, 
NON EMPTY { (
[Axe Structure Marchandise].[H-Code-SSFamille].[Code Famille].ALLMEMBERS 
* [Axe Structure Marchandise].[H-Libellé-SSFamille].[Famille].ALLMEMBERS 
* [Axe Scenario].[Scenario Id].[Scenario Id].ALLMEMBERS 
* [Axe Date Scénarios].[Aggregation].[Aggregation].ALLMEMBERS 
* [Axe Date Scénarios].[Comparaison].[Comparaison].ALLMEMBERS 
*[Axe Promotion].[Type Vente].[Type Vente].ALLMEMBERS ) }
DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME 
ON ROWS FROM ( SELECT ( { [Axe Date Scénarios].[Comparaison].&[0]} ) 
ON COLUMNS FROM ( SELECT ( { [Axe Date Scénarios].[Aggregation].&[0] } ) 
ON COLUMNS FROM ( SELECT ( STRTOSET(@AxeSiteCodeSite) )
ON COLUMNS
FROM ( SELECT ( STRTOSET(@AxeVarianteSensibilite) )
ON COLUMNS
FROM ( SELECT ( STRTOSET(@AxeStructureMarchandiseCodeRayon) )
ON COLUMNS FROM ( SELECT ( STRTOSET(@AxeSiteCodeBU, CONSTRAINED) ) 
ON COLUMNS FROM ( SELECT ( STRTOMEMBER(@FromAxeTempsTemps) : STRTOMEMBER(@ToAxeTempsTemps) )
ON COLUMNS FROM ( SELECT ( {[Axe Scenario].[Scenario].&[Objectif], [Axe Scenario].[Scenario].&[Réalisé] } ) 
ON COLUMNS 
FROM ( SELECT ( -{[Axe Structure Marchandise].[Libelle Rayon].&[CONSIGNES], [Axe Structure Marchandise].[Libelle Rayon].&[DECONSIGNES]} ) 
ON COLUMNS 
FROM ( SELECT ( -{[Axe Site].[Code Site].&[4], [Axe Site].[Code Site].&[101], [Axe Site].[Code Site].&[137] } ) ON COLUMNS 
FROM [DataMartLabelVie]))))))) )))
WHERE (StrToSet(@AxeStructureMarchandiseCodeRayon, CONSTRAINED),
IIF( STRTOSET(@FromAxeTempsTemps).Count = 1, STRTOSET(@FromAxeTempsTemps), [AxeTemps].[Date].currentmember )
, IIF( STRTOSET(@AxeSiteCodeBU, CONSTRAINED).Count = 1,
STRTOSET(@AxeSiteCodeBU, CONSTRAINED), [Axe Site].[Code BU].currentmember ) ) 
CELL PROPERTIES VALUE, BACK_COLOR, FORE_COLOR, FORMATTED_VALUE, FORMAT_STRING, FONT_NAME, FONT_SIZE, FONT_FLAGS

1 个答案:

答案 0 :(得分:0)

您需要根据复杂脚本创建一个非常简单的脚本,该脚本不会返回空值。 例如从这里开始

SELECT 
  ( 
    -{
       [Axe Site].[Code Site].&[4]
     , [Axe Site].[Code Site].&[101]
     , [Axe Site].[Code Site].&[137] 
     } 
   ) ON COLUMNS 
FROM [DataMartLabelVie];

...以上是否返回空值?希望不,所以然后添加一些大脚本的复杂性,例如。

SELECT 
  ( 
     {[Axe Scenario].[Scenario].&[Objectif], [Axe Scenario].[Scenario].&[Réalisé] } 
  ) 
ON COLUMNS 
FROM 
(
  SELECT 
    ( 
      -{
         [Axe Site].[Code Site].&[4]
       , [Axe Site].[Code Site].&[101]
       , [Axe Site].[Code Site].&[137] 
       } 
     ) ON COLUMNS 
  FROM [DataMartLabelVie]
);

你现在得到空值 - 不是吗?确定添加更多复杂性..

等等,直到找到问题为止。