Canvas Issue - math

Hey Maybe someone got that issue already -

I am doing a SQL query which is working fine - but as soon as I change the value from AVG to PERCENTILE I am getting following error message:

Whoops! Expression failed
Expression failed with the message:

[math] > Failed to parse expression. Expected "*", "+", "-", "/", or end of input but "t" found.

I checked it with the debugger and the data looks 1:1 identical:

Maybe someone got a hint .. I am pretty lost right now :slight_smile:

Hi @florian.wallner,

do you mind sharing your expression? I tried a simple example from sample data, and it worked fine, so I wonder what could go wrong in your case.

SELECT "order_date", PERCENTILE("day_of_week_i", 95) AS "95th" FROM "kibana_sample_data_ecommerce" GROUP BY "order_date"
filters
| essql 
  query="SELECT ROUND(PERCENTILE(inPercentCanvas, 95),2) AS \"95th\" FROM \"*:mon-utilization*\" WHERE hostname LIKE 'pe-001%' AND interface = 'GigabitEthernet0/0/0'  AND inPercent < 101 AND inPercent > 0"
| math "95th"
| metric "Countries" 
  metricFont={font size=48 family="'Open Sans', Helvetica, Arial, sans-serif" color="#000000" align="center" lHeight=48} 
  labelFont={font size=14 family="'Open Sans', Helvetica, Arial, sans-serif" color="#000000" align="center"}
| render

I did a little investigation and it turns out you cannot start your variable if it's used for math with a number. Change the name ''95th' to something like 'percentile95th' and it should work. I'll consult with the proper team if it's a bug or a correct behavior.

it´s working :slight_smile: thank you so much for your fast help

You're welcome! Glad to hear it worked!

It's generally not allowed to have column aliases that start with digits:

postgres=# select first_name AS 56 from test_emp;
ERROR:  syntax error at or near "56"
LINE 1: select first_name AS 56 from test_emp;
                             ^
postgres=# select first_name AS asdf56 from test_emp;
postgres=# select first_name AS asdf56 from test_emp limit 5;
  asdf56
-----------
 Georgi
 Bezalel
 Parto
 Chirstian
 Kyoichi
(5 rows)

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.