KoolReport's Forum

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

Pivot Table Convert YYYY-MM-DD to MM #310

Open V Vijaykumarr opened this topic on on Jun 11, 2018 - 2 comments

V Vijaykumarr commented on Jun 11, 2018

Hello,

I just bought the PRO, I am new to KoolReports.

I am trying to alter the pivot example report provided,

I want to pass value to this pipe,

->pipe(new Pivot(array(
      "dimensions"=>array(
        "column"=>"orderYear, orderMonth",
        "row"=>"customerName, productLine"
      ),
      "aggregates"=>array(
        "sum"=>"dollar_sales",
        "count"=>"dollar_sales"
      )
    )))

In the above code using your customer_product_dollarsales2, orderYear, orderMonth already converted to 2015, 03. But in my case i take full date(2015-03-11) from Database.

My question here is,

How to pass orderYear from my DB result (2015-03-11) ?

Thanks.

David Winterburn commented on Jun 11, 2018

Hi,

If you use date from your database, I think there is functions to convert date to day, month, quarter, year, etc. For example, using MySQL you could use:

Select month(mydate) as mymonth from mytable

Please try this and let me know if you have any question. Thanks!

V Vijaykumarr commented on Jun 11, 2018

Thanks it worked.

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
solved

Pivot