How to aggregate joined column? #694
Answered
by
Skyscimitar
HuifangYeo
asked this question in
Q&A
-
Given the below table with just the What is being summed when we do a |
Beta Was this translation helpful? Give feedback.
Answered by
Skyscimitar
Sep 21, 2022
Replies: 2 comments 1 reply
-
Hi HuiFang, tt.agg.sum(tt.agg.single_value(table["historicalPrices"]), scope=tt.OriginScope(l["ProductId"])) |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
tibdex
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi HuiFang,
Since you are aggregating a table column, it is aggregated on all levels by default. I'm assuming that there are mulitple
OrderId
perProductId
so the value you are getting forhistoricalPrices.SUM
is probably the sum of the historical price for a product over all theOrderId
it appears in.To avoid this, you should use: