Crosstab


    Crosstab reports, also known as matrix reports, to show the relationships between three or more query items.
    Crosstab reports show data in rows and columns with information summarized at the intersection points.

    *To get a clearer idea on what this report does, please choose Client(s) and check the results.*
    
class CrossTabReportView(SlickReportView):
    
    report_model = SalesLineTransaction
    date_field = 'transaction_date'
    group_by = 'product'
    columns = ['slug', 'name']

    # To activate Crosstab
    crosstab_model = 'client'
    # we corsstab on a foreignkey field

    crosstab_columns = [SlickReportField.create(Sum, 'value', name='value__sum', verbose_name=_('Sales'))
                        # To be computed for each chosen entity in the crosstab.
                        ]

                

Live Example

Filters

Results

Code Name The reminder
0 Product 0 8204
1 Product 1 8946
2 Product 2 8546
3 Product 3 8888
4 Product 4 8495
5 Product 5 8493
6 Product 6 8065
7 Product 7 8711
8 Product 8 7575
9 Product 9 8339