We are using Metabase connected to a MongoDB data source. We want to populate a dropdown filter using values from a collection named A, but with a condition based on a dynamic status variable, not a hardcoded value.
We have a dropdown filter for name field values, but the records shown in the dropdown should depend on the status.
For example:
If status = "active", dropdown shows: Record 1, Record 3
If status = "pending", dropdown shows: Record 4
If status = "inactive", dropdown shows: Record 2
In short, the list of dropdown options should be filtered based on the value of a status variable, which could itself come from another filter or be passed to the question/dashboard.
I believe you're looking for linked filters on dashboards. So you would have a status filter and a name filter that has the other filter as its parent. Would that work?
Thanks.
Yes we need similar functionality, but in our case we need to pass status filter from API.
We need to display Record name in dropdown and use _id as value.
Hmm do you have a more concrete example to illustrate what the use case would look like?
You could use URL params to pass filters. Do you want the filter to show "Record 1" and when it's selected, filter by _id = 1? You can customize filter display values (with the Edit button at the right of "Dropdown list") but this can't currently be combined with linked filters
you can't pass in a resultset from an API natively, it's not supported from what I can see, unless you have your own embedded dashbaords I guess?
Other option is to populate a table with those values periodically and then map filters to that particular table/field in your db.
There could be a funky way to perhaps do it using the metabase api also I guess but I think you'd need to store the values in a db ultimately.
Hi, I used to denomarlize the model and use the name in the final dataset as a filter, in your case, add the pipeline name on the Opportunity collection, and use it in your filter.
Question:
I have four tables: state, district, block, and village. I’ve created four dropdown filters in Metabase based on these tables.
Now, I want the dropdowns to be dependent — for example, when I select a state like West Bengal, the district dropdown should only show districts related to that selected state.
Is this possible in Metabase (free version)?
Please give me a clear "Yes" or "No"; if Yes, explain how to implement it.
If the name::_id mapping isn't unique, you need to build a model or view that provides a 1:1 mapping between a display name and _id (append the _id to the name or something). Join that model or view to your query to map the filter name.
EDIT: Another option -- Metabase may actually know how to do this internally. Set the _id field as an Entity Key an the name field as an Entity Name in the table metadata and use a field filter -- Metabase may do the mapping for you. It was discussed in this thread: