I'm running on metabase 0.45.2 and have a table named products and a column with the name brand. I'm trying to create a filter that shows the average price per brand for the brand input via the filter. However, I do not see the autocomplete and must always type the brand name. The chart works well; autocomplete is the issue.
can you provide:
- number of distinct values of the column
- is the question a gui or sql question
Hey, There are 58 distinct values in the column. It is an SQL question I'm using the brand inside the place holder like {{brand}}
is the filter a normal filter or a field filter? can you post the section of the sql question you're referring to?
See the query below. Thanks a ton for taking time to help me
SELECT AVG(price) as avg_price
FROM products
WHERE brand = {{brand}};
Use Field Filter and autocomplete will work properly.
I tried that, see the image below. I'm getting a syntax error. but when I replace the placeholder with a brand name , it works.Also In the filter widget type, I don't see an option named category.
of course you will get syntax error if you will not use it properly:
I read it multiple time, but still did not get what is wrong ?
instead of using brand = {{brand}}
just use: {{brand}}
Not sure if it is just a bad day or if I'm terrible at this. But I did not understand what you meant by the above response
just remove
"brand ="
from you SQL in screenshot
Thank you very much for tolerating me. You mean like the one below? .
SELECT AVG(price) as avg_price
FROM products
WHERE {{brand}}
Exactly!
Thanks, it worked. I spent a ton of time fixing this stupid issue. Part of the learning curve I guess