KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

Computated column of PivotTable is missing when exported to excel. #3294

Closed Nick Mason opened this topic on on May 21 - 2 comments

Nick Mason commented on May 21

Hi, I am currently trying to export PivotTable to Excel and the PivotTable has computated column like the following:

->pipe(new Pivot([
    "dimensions" => [
        "row" => 'A',
        "column" => [
            "B",
            "C" => [
                "computations" => [
                    "D" => function ($aggRow, $measure) { 
                        ...
                    }
                ]
            ],
            "E"
        ],
    ],
    "aggregates" => [
        "sum" => "F"
    ],
]))

The above PivotTable shows computated column fine in a report. However, once the report gets exported to excel, it somehow misses column 'D' which is computated.

Can we display computated column in exported excel?

Thank you :)

Sebastian Morales commented on May 22

We seem not to be able to replicate this issue. In our test Excel/PivotTable widget does show computational columns like the web view does. Would you pls post your Pivot process, PivotTable web and excel widget code for us to check it for you?

Nick Mason commented on May 23

Sorry, I have just found out the problem.

In reportExcel.php, 'hideSubTotalColumns' option of PivotTable widget was on, thereby hiding the computated column like the following:

PivotTable::create([
...
 // Previous
 'hideSubTotalColumns'  => true,
 // Now
 'hideSubTotalColumns'  => false,
...
])

Thanks for the reply :)

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
None yet

None