Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have a Filter for "Child" on my sheet.
I have 2 charts - one that displays data for the "Child" selected in the filter
I have another stacked bar chart that brings bars, the bars should be the name of all the "Child" whose "Parent" is the value selected in the Child Filter. Below is my sample data model -
Child | Parent |
Castle – Business Unit | NULL |
Castle Media | Castle – Business Unit |
Castle Solutions | Castle – Business Unit |
Castle Teleservices | Castle – Business Unit |
Castle Group | Castle – Business Unit |
Group Finance | Castle Group |
Group Human Resources | Castle Group |
Group Regulatory Affairs | Castle Group |
Technology, Strategy & Development | Castle Group |
Treasury & Debt Execution | Castle Group |
I want to write an expression that would select the stacks of the bar chart such that,
Bar expression = All Child, where parent = (child selected in the filter)
I am totally new to qlik sense, there might be a straight forward way for this, may be I just dont know it yet.
You can do this if you create an ancestor table in the load script, using HierarchyBelongsTo.
See https://help.qlik.com/en-US/qlikview/May2021/Subsystems/Client/Content/QV_QlikView/Scripting/ScriptP...
Suggested reading:
https://community.qlik.com/t5/Qlik-Design-Blog/Unbalanced-n-level-hierarchies/ba-p/1474325
https://community.qlik.com/t5/QlikView-Documents/Hierarchies/ta-p/1487801
Although I agree that creating a hierarchy in this case should be the preferred solution, I just wanted to add that in case you are looking for a solution that only uses direct descendants (i.e. across 1 level), then using a set expression like
{$<Child=, Parent=p(Child)>}
or
{$<Child=, Parent=$::Child>}
might be enough.
hope this helps
Marco