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 8377
1 Product 1 7097
2 Product 2 7806
3 Product 3 8182
4 Product 4 7562
5 Product 5 8193
6 Product 6 8059
7 Product 7 8344
8 Product 8 8095
9 Product 9 8899