KoolReport's Forum

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

Difference Calculation #343

Closed Keith Burke opened this topic on on Jul 2, 2018 - 4 comments

Keith Burke commented on Jul 2, 2018

Is it possible to use a calculated column to show the difference between a column value on row n and n-1?

Sample data [Column Difference would be the calculated column]

Date         Sales   Difference
2018-07-01   10
2018-07-02   5       -5
2018-07-03   100     95
2018-07-04   250     150
KoolReport commented on Jul 3, 2018

I have created a simple DifferenceColumn, I will send you by email. To use it you do:

->pipe(new DifferenceColumn(array(
    "diff"=>"sales"
)))
Keith Burke commented on Jul 3, 2018

That works a treat. Thank you so much.

Adalberto Rosas Couret commented on Mar 9, 2020

Could you please send me the DifferenceColumn column please...

KoolReport commented on Mar 9, 2020

Hi Adalberto,

The DifferentColumn has been inside KoolReport 4.x already. You can use it now.

Add this to your php file

use \koolreport\processes\DifferenceColumn;

and then you can use DifferenceColumn process like above example.

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
help needed
solved

None