Below calculates the SalesMonth, CountryName, SegmentName, PromotionRate and TotalMonthlySales of each segment within each country for each month from 1/1/2016 onwards.
with monthly_sales_info as (
select
Results top 3:
SalesMonth | CountryName | SegementName | PromotionRate | TotalMonthlySales |
---|---|---|---|---|
2016-03-01 | Canada | Midmarket | 0.106557 | 424880.85 |
2016-05-01 | Canada | Midmarket | 0.089285 | 159978 |
2016-02-01 | France | Government | 0.149821 | 524671.78 |
I now need to only return the top performing country/segment for each month from 1/1/2016. Multiple countries can have multiple segments. One segment is in one country.