Instread of using metrics, You may use the SimpleCard via KWidget like following:
<?php
class OrderNetMetric extends \koolreport\dashboard\widgets\KWidget
{
protected function onCreated()
{
$this->use(\koolreport\amazing\SimpleCard::class);
}
protected function onRendering()
{
$range = $this->sibling("DateRange")->value();
$value = Incognito::rawSQL("
SELECT
orderTotal - orderTax - orderShipping - orderShippingTax - cartDiscount - cartDiscountTax - refundAmount AS orderNet
FROM
viuInvoicesRefundsByDate
WHERE
transactionDateTimestamp between '" . $range[0] . "' and '" . $range[1] . "'
")
->run()
->getScalar(); //Query to get value only
$this->settings([
"title"=>"Order Net"
"value"=>$value
]);
return true;
}
}
Let us know if you need further assistance.