Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to sort on hierarchical dimension in a chart object?

Hello,

I have a simple bar chart with a hierarchical dimension. I wish to sort the X-Axis based on the level of the dimension. My hierarchy is like SBU > BU > Sub BU. At each level of drill down I expect it to be sorted on an independent sort field that is already defined. One possible way is to have a combined sort order in a single field and as you drill down it should continue with the expected sort order.

Let me know if my question is clear, else I will attempt to explain further.

Advance thanks.

4 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

You can use the GetCurrentField function to check which field in the drilldown group is active. You can use that in an expression to determine the sorting:

If(GetCurrentField([MyDrillDonGroup])='SBU',  ...sort_expression_for_sbu... ,

     If(GetCurrentField([MyDrillDownGroup])='BU', ...sort_expression_for_bu... , ...sort_expression_for_SubBU... ))


talk is cheap, supply exceeds demand
Not applicable
Author

Thanks. Sounds logical. However, for some reason I am unable to pick the Group dimension that is named as OrgHierarchy. I tried this syntax but it did not work.

=If(GetCurrentField('OrgHierarchy')='SbuAbbr',  SbuSortOrder ,

     If(GetCurrentField('OrgHierarchy')='BuAbbr', BuSortOrder ,

      If(GetCurrentField('OrgHierarchy')='SubBuAbbr', SubBuSortOrder )))

Typing [OrgHierarchy] did not work too.

Am I missing some point?

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

That should work. Try using the GetCurrentField function in a textbox and see what it returns. Or post a qlikview document that demonstrates the problem so we can have a look at what's going on.


talk is cheap, supply exceeds demand
Not applicable
Author

I will certainly try this today and revert.

In the meantime, I was able to research another alternative. One can define sort orders for each of the hierarchical dimensions similar to any other charts. Click Edit Groups, Select the drill down dimension and click edit. Next click sort orders in the bottom of dialog box. Select each level and define your sort preferences.

This works and is pretty elegant.