How to filter a question by a list of values

Hi,
I am trying to extract data with a filter for a list of values.
For example, I have a table that contains data about fruit and their nutrition value but I want to get the data for both Bananas and Apples.

Regular QL would we:

select *
from fruits_data
where fruit_type in ('Banana', 'Apple')

When I try this in Metabase, I only get the first value.
Can I do this?

Thanks,
Chen

Hi @ChenB

Post "Diagnostic Info" from Admin > Troubleshooting.

Metabase just sends your SQL to your database, so I'm guessing that you don't have correct data, or you are returning more rows than what is being displayed.

Try with

select fruit_type, count(*)
from fruits_data
where fruit_type in ('Banana', 'Apple')
group by fruit_type

Firstly, you have to check data. Maybe you don't have data with fruit_type = 'Apple'. For check this, you can write this query.

select distinct fruit_type from fruits_data.

Then look query result and tell me which types you have.

Hi @flamber and @Huseyn!
Thanks for your answers :slight_smile:

I have data for a lot of fruits in this table.
I want to put a filter like in the image below. This will allow other folks that do not know SQL to filter the results.

Again - I want to use:
fruit_type in ({{fruit_type_filter}})

Can this be done?

01

@ChenB Have a look at Field Filters: select * from fruits_data where {{fruits}}
https://www.metabase.com/learn/sql-questions/field-filters

@flamber field filter is a good feature and i use it a lot. But it will be great if we can improve it a little bit. Fielt filter take all values and show you as multiselection. Sometimes we need to show not all values but only selected one in multiselection choice. Can we improve this feature and give us management to choose which elements show in multiselection?

@Huseyn There's a request for that:
https://github.com/metabase/metabase/issues/5245 - upvote by clicking :+1: on the first post

If you want to use a regular Text filter, then there's several options to make that work with comma separated strings, but it depends heavily on the specific database type:
https://github.com/metabase/metabase/issues/4728

Text filter is not good for end user. Because analyst know which data need to add, but the end user which uses reporting always will ask about values.

@flamber i looked to issue but all issues was closed((

@Huseyn Issue 5245 and 4728 are still open.

Sorry my mistake, thanks. Can we look the priority of this issue?

@Huseyn There are 2000 issues. Click :+1: on issues to help prioritize them. Upvotes is not the only indicator of priority - there are several internal priorities as well.
The public roadmap is available here: https://www.metabase.com/roadmap/

I've already voted. Thank you very much