Posts

Showing posts with the label activepivot

How to aggregate on a column while grouping by several columns values using CoPPer?

How to aggregate on a column while grouping by several columns values using CoPPer? I have a dataset with the current stock for some products: +--------------+-------+ | Product      | Stock | +--------------+-------+ | chocolate    | 300 | | coal         | 70 | | orange juice |   400 | +--------------+-------+ and the sales for every product over the years for the current month and the next month in another dataset: +--------------+------+-------+-------+ | Product      | Year | Month | Sales | +--------------+------+-------+-------+ | chocolate    | 2017 | 05 |    55 | | chocolate    | 2017 | 04 |   250 | | chocolate    | 2016 | 05 |    70 | | chocolate    | 2016 | 04 |   200 | |     |   | | |    | | | | | coal         | 2017 | 05 |    40 | | coal         | 2017 | 04 |    30 | | coal         | 2016 | 05 |    50 | | coal         | 2016 | 04 |    20 | |     |   | | |    | | | | | orange juice | 2017 |    05 | 400 | | orange juice...