Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
engishfaque
Specialist III
Specialist III

Sum of child values

Dear All,

I'm going to add child values based on parent and trying to hide Parent, here is the input and required output.

Input

ParentChildValues
NI-R6501-Gadsden35-MF-006-Set31
NI-R6501-Gadsden35-MF-006-Set3NI-gadsden355
NI-R6501-Gadsden35-MF-006-Set3NI-MF-0062
NI-R6501-Gadsden35-MF-006-Set3NI-R6501-ZZ81

Required Output: Parent value = 1, then add 1 in each child values such as given below table. As well as only shows child not parent.

NI-gadsden356
NI-MF-0063
NI-R6501-ZZ82

Kind regards,

Ishfaque Ahmed

7 Replies
stigchel
Partner - Master
Partner - Master

If I understood you correctly something like

Sum(Values)+Aggr(Sum(TOTAL <Parent> if(len(Child)=0,Values)),Parent,Child)

Also see attached

engishfaque
Specialist III
Specialist III
Author

Dear Piet,

I need to convert this logic into qlikview,

Sum(child values + parent value) where childs belongs to their own parent.

Kind regards,

Ishfaque Ahmed

engishfaque
Specialist III
Specialist III
Author

Dear Piet,

Is this possible we use, p() in expression to achieve required output?

Kind regards,

Ishfaque Ahmed

Anonymous
Not applicable

If you have a field that indentifies Parent/Child, for example Type, you can have a straigth table with

-first dimension (calculated): if(Type='Parent', Parent) with option Suppress When Value is null and where Parent is the field shown in your table above;

-second dimension: Child;

-expression: sum(value) + sum({<Type={'Parent'}>} value).

It seems to work,

let me know.

BR

Elena

engishfaque
Specialist III
Specialist III
Author

Dear Elena,

I made expression, my expression is working when I'm going to select particular parent child set.

But issue is coming when I'm going to press clear button.

For example:

27 records are there with having type = parent, when I press button clear these parent values are going to be added and effecting to others.

Kind regards,

Ishfaque Ahmed

MarcoWedel

Hi,

one solution in the script could be:

QlikCommunity_Thread_150075_Pic1.JPG

table1:

Hierarchy(ChildID, ParentID, Child,,Values ,'Total Values','+','Depth')

LOAD *,

    AutoNumber(Child) as ChildID,

    AutoNumber(Parent) as ParentID;

LOAD Parent,

    If(Len(Child),Child,Parent) as Child,

    Values

FROM [http://community.qlik.com/thread/150075] (html, codepage is 1252, embedded labels, table is @1);

Right Join (table1)

LOAD Child,

    [Total Values],

    Evaluate([Total Values]) as [Total Value]

Resident table1

Where Depth=2;

DROP Field [Total Values], ChildID, ParentID;

hope this helps

regards

Marco

sujeetsingh
Master III
Master III

You can go with the input field in your application.

That means what ever be the value of Parent, the value gets added in the child details.