You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Qlik仪表板:点击Multi KPI动态切换趋势图表的实现可行性咨询

Answer

Absolutely! This is totally doable with Qlik's built-in features—no JavaScript required, which is perfect for a new Qlik dashboard builder. Here's a step-by-step breakdown to implement the click-to-switch trend chart:

Core Concept

We'll use a variable to control which metric the trend chart displays, then add a click action to each Multi KPI that updates this variable to its corresponding metric.

Step 1: Create a Control Variable

  1. Go to App overview > Edit > Variables (or use the variable editor shortcut).
  2. Create a new variable, e.g., vSelectedKpiMetric.
  3. Set its initial value to the metric expression of your first Multi KPI (wrap it in single quotes to treat it as a string). For example:
    'Sum(TotalSales)'
    
    This ensures the trend chart loads with your first KPI's trend by default.

Step 2: Configure the Trend Chart (GRAPH 1)

  1. Add your line/bar trend chart to the dashboard, set its dimension to your 13-week time field (e.g., Week).
  2. For the chart's metric, use the variable to dynamically pull the selected KPI's data. Enter this expression in the metric field:
    $(vSelectedKpiMetric)
    
    This tells Qlik to evaluate the variable's current value as the metric for the chart.

Step 3: Add Click Actions to Each Multi KPI

  1. Edit any of your Multi KPIs, go to the Actions tab.
  2. Click Add Action > Set Variable.
  3. In the action settings:
    • Select your variable vSelectedKpiMetric
    • Set the Value to the exact metric expression used in this Multi KPI (again, wrap in single quotes). For example, if this KPI tracks profit, use:
      'Sum(TotalProfit)'
      
    • Set the Trigger to On Click (this avoids conflicting with your existing double-click jump action).
  4. Repeat this for all 11 Multi KPIs, updating the value to match each KPI's unique metric.

Optional Optimizations

  • If you're using Qlik's Metric Library to store your KPIs, you can reference the metric's ID directly instead of copying expressions. For example:
    '=Metric("MetricID-123")'
    
    This keeps your setup cleaner and avoids duplicate code.
  • Add a visual indicator (like a border color change) to the selected Multi KPI using conditional formatting tied to the variable. For example, set the KPI's border color to blue when vSelectedKpiMetric = 'Sum(TotalSales)'.

Testing

Save your changes, then test clicking each Multi KPI—your trend chart should instantly switch to display the 13-week trend for that KPI, while double-clicking still triggers your existing dashboard jump.

内容的提问来源于stack exchange,提问作者Michael Owen

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.14 08:52:31