Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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 | ||
Branch | Amount | MapKey |
A | 10 | 1 |
A | 20 | 2 |
B | 10 | 1 |
B | 30 | 2 |
T | 100 | 3 |
Map Table | |
MapKey | Line |
1 | P |
2 | CA |
3 | Oth |
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:
Branch | Amount | MapKey |
A | 10 | 1 |
A | 20 | 2 |
B | 10 | 1 |
B | 30 | 2 |
A | 40 | 3 |
B | 60 | 3 |
How can I do this in Qlik?
Thank you!
check attached qvw
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.
Is this something you want to do in the script or front end?
It's all one to me now, but I think it's better to do it in the script...