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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
simonagheo
Contributor III
Contributor III

Split sum

Any idea how can I split a sum between branches depending on some variable values?

I have an Amount table and a Map table. Amount table input:

  

Amount Table
BranchAmountMapKey
A101
A202
B101
B302
T1003

  

Map Table
MapKeyLine
1P
2CA
3Oth

For each branch excepting T I have to calculate the value of CA/P:

Branch A: 20/10 = 2

Branch B: 30/10 = 3

Branch A proportion: 2/5 = 0.4 %

Branch B proportion: 3/5 = 0.6 %

Depending on this proportion I will divide the amount for branch T:

For branch A: 100*0.4 = 40

For branch B: 100*0.6 = 60

So the Amount table should look like this:

  

BranchAmountMapKey
A101
A202
B101
B302
A403
B603

How can I do this in Qlik?

Thank you!

4 Replies
Not applicable

check attached qvw

simonagheo
Contributor III
Contributor III
Author

Thank you! But when I select Branch A, I need to see Amount: 10, 20, and 40... Branch T must be deleted, and Amt must be split to other branches.

sunny_talwar

Is this something you want to do in the script or front end?

simonagheo
Contributor III
Contributor III
Author

It's all one to me now, but I think it's better to do it in the script...