我在pentaho仪表板中添加了提示。我想在该提示中添加“ALL”类别,这意味着当我选择“ALL”时,它不应该过滤数据,它应该获取所选类别下的所有数据。你能帮助我吗?
答案 0 :(得分:0)
为此使用Type SQL List和“All”作为值(注意区分大小写)。一个示例查询将是:
SELECT DISTINCT 'All' AS VAL, 'ALL TERRITORIES' AS DESC FROM customer_w_ter
UNION ALL
select DISTINCT TERRITORY, TERRITORY from customer_w_ter
答案 1 :(得分:0)
select 'All' as accountclass
,status
,count(guaccountid) as count
from sms_accountinformation
group by status
union
select distinct accountclass
,status
,count(guaccountid)as count
from sms_accountinformation
group by accountclass,status
order by accountclass,status
没有硬编码有没有其他选择?
数据集如下所示
"All";"Active";2288
"All";"PD";257
"All";"TD";777
"Customer";"Active";2275
"Customer";"PD";152
"Customer";"TD";359
"Dealer";"Active";13
"Dealer";"PD";105
"Dealer";"TD";418
答案 2 :(得分:0)
您在查询中需要做的是添加一个额外的行" ALL "数据。在为ALL部分编写查询时,不需要执行group by子句。检查以下代码(希望它更清楚):
select distinct
accountclass,
status,
count(guaccountid)as count
from sms_accountinformation
group by accountclass,status order by accountclass,status
union
select 'ALL' as accountclass,
'ALL' as status,
'ALL' as count
from sms_accountinformation
这会使用' ALL'来获取结果集。再过一行,您可以在过滤器列表中使用它。
希望有所帮助:)