如何在肥胖仪表板中实现以下目标 [英] How to achieve the below goal in obiee dashboard

查看:92
本文介绍了如何在肥胖仪表板中实现以下目标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个如下表:

id name role1 role2 role3
-------------------------
1  John   y    n      y
2  Pete   n    y      y
3  Den    n    y      y
4  Mat    y    n      n

使用role1='Y'过滤表后,我丢了Pete和Den.

After I filter the table by using role1='Y', I lost Pete and Den.

我如何使用分析来构建如下表:

How can I use the analysis to build a table like below:

       Count (Y)
Role1    3
Role2    2
Role3    3

我尝试了一切.请帮助

谢谢

推荐答案

如果您的数据库是Oracle 11g或更高版本,则可以使用unpivot子句

If your database is Oracle 11g or later you can use the unpivot clause

SELECT usr_role,
  COUNT(*) role_count
FROM
  (SELECT  * 
     FROM table_name 
     UNPIVOT (hasRole FOR usr_role IN (role1,role2,role3))
  WHERE hasRole = 'y'
  )
GROUP BY usr_role ;

这将返回:

USR_ROLE  ROLE_COUNT
ROLE3      3
ROLE1      2
ROLE2      2

您可以将此查询用作RPD中的不透明视图

You could use this query as an opaque view in the RPD

这篇关于如何在肥胖仪表板中实现以下目标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆