Search code examples
javascriptqliksense

Dynamic Chart from selection of any KPI boxes in Qlik


I am new to the development of Qlik and I am in the middle of building my first dashboard in Qlik. I currently have a dashboard that I am developing that has 11 Multi KPIs added on its Main Sheet that shows various Summarised Values for the Measures that it is showing and that works very well.

What I am looking to do now is to add a single chart with the space that I have left (GRAPH 1) (attached image of example of dashboard) but what I would like is to default the chart to show the first KPI's trend over a 13 week period (will create this). My main question is, is it possible for this chart to be dynamic so that I am able to single click on any of the KPI's to change the chart to show the clicked KPI's chart?

As when the KPI is double clicked this will go onto a separate dashboard so I'm not sure if this is possible.

Would appreciate if somebody could clarify if this is something that can be achieved as not sure if it's something I will have to do using some Javascript or if there is a feature that will allow me to build this in Qlik itself.

enter image description here


Solution

  • I have attached an example that includes 2 solutions:

    1. First one is made using alternative measures, so for every KPI I made an alternative measure. In my previous comment I mentioned there might be a limit to the amount of alternative dimensions/measures, but after some testing it doesn't seem like it (at least 12 work). The downside to this method is that it doesn't save the order of the alternative measures, but it changes every time you make a selection.

    2. Second solution is made using a filter object, as explained in my previous comment:

    Make a single line chart that depends on a variable for it's title/measure/dimension and combine this with a filter object where you can change this variable (all options are one of your KPI's). This does change your page a little since you need to have a filter object as well;

    Both should work, but in the end it comes down to personal preference.

    Attachment: https://drive.google.com/file/d/1wRgStl23DfcI5arQTZmt3w_0DEtW5iuf/view?usp=sharing

    Since I can't garantee this google drive link will be up forever, here is it in steps:

    Solution 1: Alternative measures:

    In the Data load editor I made a new section with the following dummy data:

        LOAD * Inline [
    Weeks, KPI1, KPI2, KPI3, KPI4, KPI5, KPI6, KPI7, KPI8, KPI9, KPI10, KPI11, KPI12
    1, 1, 2, 0, 3, 5, 1, 1, 2, 0, 3, 5, 3
    2, 2, 4, 0, 8, 5, 2, 2, 4, 0, 8, 5, 3
    3, 3, 6, 1, 4, 5, 3, 3, 6, 1, 4, 5, 3
    4, 4, 8, 1, 7, 6, 4, 4, 8, 1, 7, 6, 3
    5, 5, 10, 2, 0, 7, 5, 5, 10, 2, 0, 7, 3
    6, 6, 12, 2, 9, 7, 6, 6, 12, 2, 9, 7, 3
    7, 7, 14, 3, 13, 7, 7, 7, 14, 3, 13, 7, 3
    8, 8, 16, 3, 6, 8, 8, 8, 16, 3, 6, 8, 3
    9, 9, 18, 4, 1, 8, 9, 9, 18, 4, 1, 8, 3
    10, 10, 4, 3, 9, 10, 10, 10, 4, 3, 9, 10, 3
    11, 11, 5, 3, 9, 10, 11, 11, 5, 3, 9, 10, 3
    12, 12, 5, 8, 9, 10, 12, 12, 5, 8, 9, 10, 3
    ];
    

    Then I added a "Line chart" object to a page and gave it the measure "Weeks". I also added a measure with expression: KPI1. Then I added 11 alternatives measures the exact same way for every KPI. So like this:

    Alternative measures

    This should result in this:

    End result Alternative measures

    Solution 2: Filter object

    In the Data load editor I made a new section with the following dummy data:

    LOAD * Inline [
    Weeks, KPI1, KPI2, KPI3, KPI4, KPI5, KPI6, KPI7, KPI8, KPI9, KPI10, KPI11, KPI12
    1, 1, 2, 0, 3, 5, 1, 1, 2, 0, 3, 5, 3
    2, 2, 4, 0, 8, 5, 2, 2, 4, 0, 8, 5, 3
    3, 3, 6, 1, 4, 5, 3, 3, 6, 1, 4, 5, 3
    4, 4, 8, 1, 7, 6, 4, 4, 8, 1, 7, 6, 3
    5, 5, 10, 2, 0, 7, 5, 5, 10, 2, 0, 7, 3
    6, 6, 12, 2, 9, 7, 6, 6, 12, 2, 9, 7, 3
    7, 7, 14, 3, 13, 7, 7, 7, 14, 3, 13, 7, 3
    8, 8, 16, 3, 6, 8, 8, 8, 16, 3, 6, 8, 3
    9, 9, 18, 4, 1, 8, 9, 9, 18, 4, 1, 8, 3
    10, 10, 4, 3, 9, 10, 10, 10, 4, 3, 9, 10, 3
    11, 11, 5, 3, 9, 10, 11, 11, 5, 3, 9, 10, 3
    12, 12, 5, 8, 9, 10, 12, 12, 5, 8, 9, 10, 3
    ];
    
    LOAD * Inline [
    KPI,
    KPI1,
    KPI2,
    KPI3,
    KPI4,
    KPI5,
    KPI6,
    KPI7,
    KPI8,
    KPI9,
    KPI10,
    KPI11,
    KPI12
    ];
    

    Then I added a "Line chart" object to a page and gave it the measure "Weeks". I also added a measure with the following expression:

    = if(WildMatch(GetFieldSelections(KPI), 'KPI1') = 1, KPI1,
      if(WildMatch(GetFieldSelections(KPI), 'KPI2') = 1, KPI2,
      if(WildMatch(GetFieldSelections(KPI), 'KPI3') = 1, KPI3,
      if(WildMatch(GetFieldSelections(KPI), 'KPI4') = 1, KPI4,
      if(WildMatch(GetFieldSelections(KPI), 'KPI5') = 1, KPI5,
      if(WildMatch(GetFieldSelections(KPI), 'KPI6') = 1, KPI6,
      if(WildMatch(GetFieldSelections(KPI), 'KPI7') = 1, KPI7,
      if(WildMatch(GetFieldSelections(KPI), 'KPI8') = 1, KPI8,
      if(WildMatch(GetFieldSelections(KPI), 'KPI9') = 1, KPI9,
      if(WildMatch(GetFieldSelections(KPI), 'KPI10') = 1, KPI10,
      if(WildMatch(GetFieldSelections(KPI), 'KPI11') = 1, KPI11,
      if(WildMatch(GetFieldSelections(KPI), 'KPI12') = 1, KPI12,
    ))))))))))))
    

    After that I added a new "Filter object" to the page with dimension: KPI. As a final step I go to "Fields" -> right click "KPI" -> click "Field settings" -> check "Always one selected value" -> click "Save".

    So like this: check "Always one selected value"

    And that's it, now you have a filter object that influences your line chart.

    Hope it helped, if anything isn't clear, please let me know.