Why is Grafana wanting a numeric data type for a string used for variables?

I have created a variable for my dashboard with this query:

SELECT property_name FROM public.properties;

Then I created a Pie Chart and added this query:

SELECT NOW() as time, r2018.name, SUM(COALESCE(r2018.actual,0)+COALESCE(r2019.actual,0)+
COALESCE(r2020.actual,0))::NUMERIC AS value, properties.property_name FROM public.r2018

JOIN public.r2019 ON r2019.partner_id=r2018.partner_id
JOIN public.r2020 ON r2020.partner_id=r2018.partner_id
JOIN public.properties ON properties.property_id=r2018.property_id

WHERE property_name IN ($property)
GROUP BY property_name, r2018.name

This is the message Grafana shows:

value column must have numeric datatype, column: property_name, type: string, value:
(name of the property currently selected)

I’m not sure what the problem is, I’m using a bunch of other panels on this dashboard where it does not have any problems with the property name used as the variable.

Solved it myself, property_name is not needed in the query, only in the WHERE clause.

This topic was automatically closed after 365 days. New replies are no longer allowed.