【问题标题】:Adding "All" option to a prompt Pentaho dashboard?将“全部”选项添加到提示 Pentaho 仪表板?
【发布时间】:2015-02-15 03:44:33
【问题描述】:

我在 pentaho 仪表板中添加了一个提示。我想在该提示中添加“ALL”类别,这意味着当我选择“ALL”时,它不应该过滤数据,它应该获取所选类别下的所有数据。大家能帮帮我吗?

【问题讨论】:

    标签: pentaho pentaho-cde


    【解决方案1】:

    为此,使用类型 SQL 列表和“全部”作为值(注意区分大小写)。一个示例查询是:

    SELECT DISTINCT 'All' AS VAL, 'ALL TERRITORIES' AS DESC FROM customer_w_ter
    UNION ALL
    select DISTINCT TERRITORY, TERRITORY from customer_w_ter
    

    【讨论】:

    • 而在 MDX 中,您可以通过在 All 成员和您想要的集合之间进行联合,或者使用下面的 Descendants 函数 1 级以及 self_and_before 标记来执行相同的操作。
    【解决方案2】:

    @迈克尔克里斯托弗 我使用以下 postgresql 查询来获取数据。
    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

    【讨论】:

      【解决方案3】:

      您需要在查询中添加一个包含“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”的结果集作为另一行,您可以在过滤器列表中使用它。

      希望对你有帮助:)

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2018-12-14
        • 2018-10-10
        • 1970-01-01
        • 2016-07-25
        • 1970-01-01
        • 2018-12-19
        • 2012-12-05
        • 1970-01-01
        相关资源
        最近更新 更多