Skip to main content
Announcements
See why Qlik is a Leader in the 2024 Gartner® Magic Quadrant™ for Analytics & BI Platforms. Download Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Hierarchy path sort order

Hi,

Im stuck with the sort order in a hierarchy path.

It works to this point.

KstHierarchie:

Load

Cost_Center,

KST_Stufe_2 as KstHierarchiePath

Resident Kostenstellenhierarchie;

LOAD

Cost_Center,

if(isnull(KST_Stufe_3), KST_Stufe_2 & '\' & Cost_Center,

KST_Stufe_2 & '\' & KST_Stufe_3) AS KstHierarchiePath

Resident Kostenstellenhierarchie

where not isnull(KST_Stufe_2);

What i want to do now is to order the items in this hierarchy in a certain matter.

The sort order comes right out of the SAP table.

For example:

ItemSEQNR
Cost_Center_X1
Cost_Center_Y

2

Cost_Center_Z3

But no matter what (order by....), it wont order in the right way.

Can somebody help me?

Cheers,

Phil

2 Replies
sinanozdemir
Specialist III
Specialist III

Can you provide some sample data? You can also try to add Order By in your load script.

rubenmarin

Hi Philipp, have you tried a join?:

KstHierarchie:

Load

Cost_Center,

KST_Stufe_2 as KstHierarchiePath

Resident Kostenstellenhierarchie;

LOAD

Cost_Center,

if(isnull(KST_Stufe_3), KST_Stufe_2 & '\' & Cost_Center,

KST_Stufe_2 & '\' & KST_Stufe_3) AS KstHierarchiePath

Resident Kostenstellenhierarchie

where not isnull(KST_Stufe_2);

Left Join

LOAD Item as Cost_Center,

     SEQNR as Sort

FROM ...