Replace Field filter value

Hi I'm trying to apply a field filter to a second select (below), the filter is a date range selector, I need to get it's values to apply the filter again on select below, this select is manually data, I'm trying to get field filter value and replace, the column name, which originally is dbo.SD2010.D2_EMISSAO, but on my manual select is the date.

Anyone can help me with this?

SELECT
    date, Tipo, Total
FROM (
    VALUES
    (DATEFROMPARTS(2022, 01, 01), 'Budget', 4470000),
    (DATEFROMPARTS(2022, 02, 01), 'Budget', 4625000),
    (DATEFROMPARTS(2022, 03, 01), 'Budget', 4695000),
    (DATEFROMPARTS(2022, 04, 01), 'Budget', 5317000),
    (DATEFROMPARTS(2022, 05, 01), 'Budget', 5643000),
    (DATEFROMPARTS(2022, 06, 01), 'Budget', 5925000),
    (DATEFROMPARTS(2022, 07, 01), 'Budget', 6109000),
    (DATEFROMPARTS(2022, 08, 01), 'Budget', 6231000),
    (DATEFROMPARTS(2022, 09, 01), 'Budget', 6362000),
    (DATEFROMPARTS(2022, 10, 01), 'Budget', 6453000),
    (DATEFROMPARTS(2022, 11, 01), 'Budget', 6585000),
    (DATEFROMPARTS(2022, 12, 01), 'Budget', 6716000)
) AS TEMP(date, Tipo, Total)
[[
    WHERE REPLACE(CAST({{date}} AS VARCHAR))), 'dbo.SD2010.D2_EMISSAO', 'date') -- Tried this but doesn't work.
]]

Hi @phaetherap
You would have to create a lookup table in your database to get a dropdown with a Field Filter.
You cannot control the parameter code like that.
https://www.metabase.com/learn/sql-questions/field-filters

1 Like

I cannot write on database, that's the challenge.

@phaetherap This is not about rewriting your database, but just creating a lookup table (example a view) called metabase_budget_dropdown with the content you show.

But if you don't even have write access, then there isn't anything you can do currently except just having people input values manually into Text filters.