Canvas Multiple Math Functions ESSQL

Hi @wylie

Thanks for your reply,
Well we are running v7.5.2 Cluster for ES & Kibana and would not be upgrading the same till end of this year.
On the SQL queries here they are.

Defective Devices
"SELECT COUNT(DISTINCT b4) as scount FROM \"myindex\" WHERE QUERY(' b4:/AT[0-9]+/ AND value:1')"

Total Devices
SELECT COUNT(DISTINCT b4) as pcount FROM \"myindex\" WHERE QUERY('b4:/AT[0-9]+/')"

An update on the last Post - While working on the issue (SCENARIO 1), i did play around the math & string function to get a number (not in percentage %).

For example: Defective Device % = 3.6%
Number i get for OK Devices = 96.4

filters "live"
| essql 
  query="SELECT COUNT(DISTINCT b4) as scount FROM \"myindex\" WHERE QUERY(' b4:/AT[0-9]+/ AND value:1')"
| math 
  {string "100 - scount/" {filters | essql query="SELECT COUNT(DISTINCT b4) as pcount FROM \"myindex\" WHERE QUERY('b4:/AT[0-9]+/')" | math "pcount/100"}}
| formatnumber "0%" format="0,0.[0]%"
| metric " OK Devices" 
  metricFont={font family="'Tw Cen MT', Helvetica, Arial, sans-serif" size=72 align="center" color="#4fbf48" weight="bold" underline=false italic=false} 
  labelFont={font family="'Dubai Light', Helvetica, Arial, sans-serif" size=30 align="center" color="#FFFFFF" weight="normal" underline=false italic=false} metricFormat="0.0a"
| render