implement trends calculation and comparison by segment