Use the operator < or > in the where clause with variables when working with Gauges in MySQL

Hello there everyone!:

I’m working with gauges and I run into a stopper. I hope someone can unblock my issue here.
I got a lot of variables which are able to display different data on the same chart.
Every other variable is working, but the one I got stuck with is: Año Fiscal ( Fiscal Year)


The query is quite simple and straight forward:


In the following picture, you can see the query working. Also you will be able to see the values of the Variable Año Fiscal .

In the next iteration of my query I would like to create a clause inside the WHERE in which I could compare if the variable selected is bigger than the values in the column Año Fiscal:

When I move that query to Grafana, it returns me an error ( No data ).

Do anybody know how to make that comparation with the operator > or < ?.
I know that when we place ($Variable), is due to we got a list in the variables. That’s why it comes before the ($Variable) the IN Clause, but maybe we could find a work-around.

I don’t know if we can use other Operators (different from IN ). With the variables.

Thank you very much!

hover over the top left exclamation and post back what it says
image

is @AnioFiscal a single numeric value or a list? if it is a list your > wont work.

Also click on the Generated SQL and see if it is proper SQL

image