yes sure.
$Query = "SELECT
CASE WHEN b.rescheduled_reason_c='Call_Cancelled' THEN '1' ELSE '0' END AS Call_cancelled,
CASE WHEN b.rescheduled_reason_c!='Call_Cancelled' THEN '1' ELSE '0' END AS Call_closed
.....................................................";
$node = $this->src("mysql")->query($Query)
->pipe(new AggregatedColumn(array(
"total_close"=>array("sum","Call_closed")
)))
->pipe(new AggregatedColumn(array(
"total_cancel"=>array("sum","Call_cancelled")
)))
->pipe(new CalculatedColumn(array(
"percent"=>"{total_cancel}*100/{total_close}"
)))
->pipe(new Pivot(array(
"dimensions"=>array(
"column" => "dateyear",
"row" => "users_zone_c,address_state,source,CSCName,product_name,cateName,brand",
),
"aggregates"=>array(
"sum" => "quantity_c,Call_cancelled,Call_closed",
"count" => "quantity_c",
//'sum percent' => 'Call_closed'
)
)))
->pipe($this->dataStore('SRCancelation'));
PivotMatrix::create(array(
"id" => "pivotMatrix1",
'dataSource' => $this->dataStore('SRCancelation'),
//'hideSubtotalRow' => true,
'showDataHeaders' => true,
"scope" => array(
"reportType" => $this->params["reportType"],
"zone" => $this->params["zone"],
"state" => $this->params["state"],
"csc" => $this->params["csc"],
"sourceCall" => $this->params["sourceCall"],
"brand" => $this->params["brand"],
"fromDate" => $this->params["fromDate"],
"toDate" => $this->params["toDate"],
"year" => $this->params["year"],
"month" => $this->params["month"],
"quarter" => $this->params["quarter"],
),
"measures"=>array(
"quantity_c - sum",
"Call_cancelled - sum",
"Call_closed - sum",
"percent" // should be (Call_cancelled - sum *100)/(Call_closed - sum) but display blank.
),