I have below code. weight is from the right table, and the aggregation works. weightLeft is from the left table, and the aggregation doesn't work. Is it possible to make weightLeft works?
t:([]sym:3#`ibm;time:10:01:01 10:01:04 10:01:08;price:200 201 205;weightLeft:3 4 5);
price:101 103 103 104 104 107 108 107 108;
weight:10 20 30 10 20 30 10 20 30;
q:([]sym:`ibm; time:10:01:01+til 9; price:price; weight:weight);
f:`sym`time;
w:-2 1+\:t.time;
wj[w;f;t;(q;(sum;`price);({sum x*y};`price;`weight))]; // OK
wj[w;f;t;(q;(sum;`price);({sum x*y};`price;`weightLeft))]; // failed
I do not think it is possible to use columns from the left table in that manner. If you have use the identity operator
::as your aggregation function you can see how kdb interprets that column as a null symbol, hence the type error.For your use case could you aggregate on
pricethen multiply byweightLeftafterwards?