KoolReport's Forum

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

How to compare sales for the same quarter for two different years for a given entity #2460

Open Augustine Arthur opened this topic on on Nov 25, 2021 - 5 comments

Augustine Arthur commented on Nov 25, 2021

Please any suggestion on how to generate a report that compares the same quarters of two different years for the same parameters or indicators as shown in the image.

Sebastian Morales commented on Nov 26, 2021

Pls use the quarter function in your sql query and then the Cube process in your report:

//MyReport.php
$this->src("mysql")
->query("select quarter(activity_date) as 'activity_quarter', activity, ...") // other databases might have different quarter function from MySQL.
->pipe(new koolreport\cube\processes\Cube(array(
    "row" => "activity", 
    "column" => "activity_quarter",
    "count" => "actitivy",
)))
...

Let us know if we understand your question correctly. Tks,

Augustine Arthur commented on Nov 26, 2021

Thank you for the response. I will try it. I will get back to you for any further assistant if the need arises. I think I will also want to create multiple selection for years so that I will select which years I want to compare their quarters.

Augustine Arthur commented on Apr 20, 2023

Please I have not been able to solve the issue. Please any help.

Sebastian Morales commented on Apr 21, 2023

Pls concat year(activity_date) and quarter(activity_date) to create Year Quarter column and group/cube by that. Rgds,

Augustine Arthur commented on Apr 21, 2023

I will implement that. Thanks

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