Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Element with multiple parents in hierarchy

Hi,

We have a situation where some elements have multiple parents. This come from the fact that we are simplifying a time dependant hierarchy in the source system. A company can belong to a certain group in a certain year, but than change ownership in a different year. We are using the hierarchy function. This works fine as long as the company stays in the same level. However, if the company moves level, it doesn't work.

Let take the following script to build the hierarchy:

////

Stuff1:
LOAD * INLINE [
Parent, Child
,AA
,BB
AA, A
BB, A
BB, B
BB, C
A,1
B,2
C,3
B,1
B,A
];
Stuff2:
Hierarchy([Child],[Parent],[ChildName],,[ChildName],[Hierarchy],'/%/',)
LOAD
Child as ChildName,
*
RESIDENT Stuff1;
DROP TABLE Stuff1;

////

We see that the company A belongs to AA, BB and B. Which means A is twice in the level 2 and once in the level 3. Unfortunatly, the last "situation" is discarded by the hierarchy function as shown bellow:

error loading image

Is this a bug? Has someone found a workaround?

6 Replies
Not applicable
Author

Hi there, I would suggest you to use the hierarchy funtion once per year. This way, you are gonna have to iterate over the years and create a hierarchy corresponding to each year, then concatenate results.

Hope this helps.

Regards

Not applicable
Author

That would be a typical time dependant hierarchy where the top node is the year and then the companies. The drawback is that the user would have to chose the year twice; once as a filter on the data and once on the navigation for the company. That is what we trying to avoid. Furthermore, in a near future, the companies might change ownership within the year. We would have a different structure for each month!

Cheers.

Not applicable
Author

Yes you are right, and I agree that this is not the behaviour you would expect. However the only solution I see right know is dividing the hierarchies by temporality, if your only concern is making the user select a year twice, you can do it automatically with qlikview using the actions feature.

Regards

Not applicable
Author

And have the right hierarchy element appearing after the period selection. Good idea. The whole process would probably need to be build so that there is no additional work when a new period is made available.

Still, I am wondering if the current behaviour is correct or if this is a bug. I would go for the bug because if you allow an element to appear multiple times, you should allow to have it in a different level.

Thanks!

Not applicable
Author

I would go for a bug, I'm guessing it was not a forseen case within hierarchy structures. I think you can ask Qliktech and see what they say, in the mean time you can try the multiple hierarchy approach.

Good luck

Regards

whiteline
Master II
Master II

I think, in your case hierarchy function avoids circular reference.