Ventilate value year to all months (hive SQL)
Hazou
Registered Posts: 7 ✭✭✭✭
-1
Hello,
I have this table
Country Year Value
US | 2020 | 1200 |
GE | 2020 | 2400 |
I want to ventilate the value of the year over all the months (value year / 12)
Country Year Month Value
US | 2020 | 1 | 100 |
US | 2020 | 2 | 100 |
... | ... | ... | ... |
GE | 2020 | 1 | 200 |
Thanks.
Best Answer
-
you can make a small dataset with 1 row per month, a cartesian join with that dataset to your table, and compute value * fraction.
The dataset can be a simple editable dataset like:
The join can compute the dispatched value with a post-join computed column like