Time series (without Group by)


    In this example we are telling Slick Reporting to create a monthly time series for the sum of the `value` field.
    However without giving a group_by, so it operate on the all the records
    and gives us a one line sum of all `values` row in the report model.

    
class NoGroupByTimeSeries(SlickReportView):
    
    report_model = SalesLineTransaction
    date_field = 'transaction_date'
    columns = ['__time_series__',
               SlickReportField.create(Sum, 'value', verbose_name='Grand Total')
               ]

    time_series_pattern = 'monthly'
    time_series_columns = [
        SlickReportField.create(method=Sum, field='value', name='value__sum', verbose_name=_('Sales'))
    ]

    # A chart for our total values
    chart_settings = [
        {'type': 'bar',
         'data_source': ['value__sum'],
         'title_source': ['name'],
         'title': 'Total sales per month',
         'plot_total':True,
         }
    ]

                

Live Example

Filters

Results

Sales 2021/01/01 - 2021/02/01 Sales 2021/02/01 - 2021/03/01 Sales 2021/03/01 - 2021/04/01 Sales 2021/04/01 - 2021/05/01 Sales 2021/05/01 - 2021/06/01 Sales 2021/06/01 - 2021/07/01 Sales 2021/07/01 - 2021/08/01 Sales 2021/08/01 - 2021/09/01 Sales 2021/09/01 - 2021/10/01 Sales 2021/10/01 - 2021/11/01 Sales 2021/11/01 - 2021/12/01 Sales 2021/12/01 - 2022/01/01 Grand Total
7035 5937 6522 6759 6814 6639 7044 6304 6541 7279 7061 6679 80614