Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I want to calculate in script by resident ?
eg, Qty : Sum(sale_units)
Value : Sum(sale_units) * Sum ( Value)
NB: sale_units and Value are from different table.
You can create a Temporary table and pull the data from both tables in that (using the appropriate join/concatenation).
Then you can do the calculations using Resident of Temporary table.
Example:
Test1:
Load
A, B
from temp1;
Test2:
Load A,B1,C
from temp2:
The temporary table will be:
Temp :
Load
A, B
from temp1;
Concatenate (Temp)
Load A,B1,C
from temp2:
Finally for calculation:
Load
A,
B*B1,
C
Resident Temp;
Hope this helps!
Hi,
Please Post your sample file
Resident used for some fields from already loaded table and manually loaded table
for your concern where your field exists in table simply write
sale_units as Qty
sale_units * Value as Value
or if you want sum function then it works with group by clause because it is aggrgate function
after loaded table like
table:
load A,
B
C from table;
newtable:
load C,
sum(A) as Qty,
sum(B)*sum(A) as Value
resident table group by C;
hope t helps
Is I can understand from your question, you have
Table1 with “Items” and “sale_units” columns and Table2 with “Item” and “Value” columns
In this case you need to join those two tables and get required value
//Join two tables
Left Join(Table1)
Load *Resident Table2;
//Calculate the required Value : Sum(sale_units) * Sum ( Value)
ResultTable:
Load Item, sum(sale_unit)*sum(Value) resident Table1 group by Item;
Hi,
Did this resolve your isue, if so can you please mark the answers as correct/helpful so it will helpful for others to identify.