0

我写了一个查询,如下所述:

WITH 
  SET [kpi_study] AS 
    {[study].[study].[BHC June12]} 
  SET [geographic] AS 
    {[territory.market_hierarchy].[state].[HP]} 
  SET [brand] AS 
    {[brand.brand_hierarchy].[brand].[Gold Flake (Unspecified)]} 
  SET [edu12] AS 
    IIF
    (
      'All' = 'All'
     ,[education].[education].MEMBERS
     ,[education].[education].[All]
    ) 
SELECT 
  NON EMPTY 
    {[Measures].[tom]} ON COLUMNS
FROM [funnel_analysis]
WHERE 
  {[kpi_study]*[geographic]*[brand]};

结果:汤姆:4.19

如果我通过(SSC/HSC )而不是全部,任何其他值总是得到相同的值。可以在我做错的地方帮助我。这意味着 IIF 功能无法正常工作。

4

1 回答 1

0

您有以下内容:

 SET [edu12] AS 
    IIF
    (
      'All' = 'All'
     ,[education].[education].MEMBERS
     ,[education].[education].[All]
    ) 

所以我猜All是占位符?!- 你说当你改变其中一个时,什么也没有发生。

这是因为在您的选择中,您实际上并没有使用被SET调用[edu12],那么为什么会有任何变化?

SELECT 
  NON EMPTY 
    {[Measures].[tom]} ON COLUMNS
FROM [funnel_analysis]
WHERE 
  {[kpi_study]*[geographic]*[brand]};

[edu12]应该在行上?

于 2016-06-13T17:21:27.730 回答