Group By

    Let's start aggregating and computing values for groups of data in our report model.

    This an example of "Total Sales Of Each Product"
class GroupByIntro(SlickReportView):
    report_model = SalesLineTransaction
    date_field = 'transaction_date'

    group_by = 'product'
    # We can group_by a foreign key or date field

    columns = ['name',
               SlickReportField.create(method=Sum, field='value', name='value__sum', verbose_name=_('Total sold $'))
               # a Slick Report Field is responsible for carrying on the needed calculation(s).


Live Example



Name Total sold $