SELECT username, count(companies.id) as total
FROM companies
JOIN users ON user_id = users.id
WHERE companies.enabled = 1
AND users.active = 1
AND companies.priority < 4
GROUP BY users.id
ORDER BY users.username
Pie Chart dashboard
{
"report_id": ??,
"category": "class",
"value": "total",
"table": true,
"showTotals": true
}
Parent = Demo and enable it