oracle 在obiee的饼图中反向显示

sz81bmfz  于 2023-10-16  发布在  Oracle
关注(0)|答案(1)|浏览(98)

我有一个问题,在OBIEE,我创建饼图,但它不显示正确。我写这个措施:case when“n_dim_city_senderDim”.“sendercityname”='sendercityname ' then '1' when“n_dim_city_senderDim”.“sendercityname”IN('sendercityname','sendercityname')then '2' end
但是2应该大于1。它显示的是反向的我怎么才能改正呢?!
我在不同的地方扔了测量器,但它不起作用

goucqfw6

goucqfw61#

如果我没理解错的话

case when "n_dim_city_senderDim"."sendercityname" ='تهران'           then '1' 
     when "n_dim_city_senderDim"."PROVINCENAME"  IN ('البرز', 'تهران') then '2' 
end

返回1,而您期望它返回2。这是因为有些行同时包含province_namesendercityname,它们都等于/,并且包含在您指定的值中。
如果provincename应该优先,则将条件切换为

case when "n_dim_city_senderDim"."PROVINCENAME"  IN ('البرز', 'تهران') then '1' 
     when "n_dim_city_senderDim"."sendercityname" ='تهران'           then '2' 
end

**[编辑]**说明:

样本数据:

SQL> select * from test order by 1;

SENDERCITYNAME  PROVINCENAME
--------------- ---------------
Montreal        Quebec
Winnipeg        Manitoba

第一个查询:

SQL> select
  2    sendercityname,
  3    provincename,
  4    case when sendercityname = 'Montreal'            then 1
  5         when provincename in ('Quebec', 'Manitoba') then 2
  6    end as result
  7  from test
  8  order by 1;

SENDERCITYNAME  PROVINCENAME        RESULT
--------------- --------------- ----------
Montreal        Quebec                   1
Winnipeg        Manitoba                 2

第二个查询,其CASE表达式与第一个查询相反

SQL> select
  2    sendercityname,
  3    provincename,
  4    case when provincename in ('Quebec', 'Manitoba') then 1
  5         when sendercityname = 'Montreal'            then 2
  6    end as result
  7  from test
  8  order by 1;

SENDERCITYNAME  PROVINCENAME        RESULT
--------------- --------------- ----------
Montreal        Quebec                   1
Winnipeg        Manitoba                 1

SQL>

看到区别了吗?

相关问题