Custom Input for Custom Query

I have written a custom query joining multiple tables which did not seem feasible with the Metabase editor. But the thing is I want to provide an input by the user to filter the results further (this input parameter will be an additional filter in the above custom query). Is there any way possible to do this?

Hi @shubham-mt
Post your query, then we can see if it might be possible to do in the Notebook editor.
You can use filters in Native queries if that is what you are asking for:
https://www.metabase.com/docs/latest/users-guide/13-sql-parameters.html

Hi @flamber. This is the query. In this query I want VIDEO as a dynamic parameter. This can be any other mediaType like AUDIO and so on.

with t1 as (
SELECT COUNT(db.table1.mediaid) AS media_create_count, CAST(db.table1.timestamp AS DATE) AS date
FROM db.table1 WHERE mediatype = ‘VIDEO’
GROUP BY CAST(db.table1.timestamp AS DATE)
),
t2 as (
SELECT COUNT(DISTINCT db.table1.mediaid) AS media_process_success_count, CAST(db.table1.timestamp AS DATE) AS date
FROM db.table1, db.table3
WHERE db.table1.mediaid = db.table3.mediaid and db.table3.representationType = ‘RESOLUTION’ and db.table3.status = ‘SUCCESS’
GROUP BY CAST(db.table1.timestamp AS DATE)
),
t3 as (
SELECT COUNT(DISTINCT db.table1.mediaid) AS media_create_success_count, CAST(db.table1.timestamp AS DATE) AS date
FROM db.table1, db.table2
WHERE db.table1.mediaid = db.table2.mediaid and db.table2.status = ‘SUCCESS’ and mediatype = ‘VIDEO’
GROUP BY CAST(db.table1.timestamp AS DATE)
)
SELECT t1.media_create_count, t3.media_create_success_count, t2.media_process_success_count, t1.date
from t1 full outer join t2 on t1.date = t2.date
full outer join t3 on t1.date = t3.date
ORDER BY t1.date

@shubham-mt Then just do mediatype = {{mediatext}} if you’re using a Text Filter, and {{mediafield}} if you’re using a Field Filter.