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 2022/01/01 - 2022/02/01 Sales 2022/02/01 - 2022/03/01 Sales 2022/03/01 - 2022/04/01 Sales 2022/04/01 - 2022/05/01 Sales 2022/05/01 - 2022/06/01 Sales 2022/06/01 - 2022/07/01 Sales 2022/07/01 - 2022/08/01 Sales 2022/08/01 - 2022/09/01 Sales 2022/09/01 - 2022/10/01 Sales 2022/10/01 - 2022/11/01 Sales 2022/11/01 - 2022/12/01 Sales 2022/12/01 - 2023/01/01 Grand Total
0 0 0 0 0 0 0 0 0 0 0 0 0