Slicing a query paramter based on another query paramter value

The query “Sales by Region and City” is: select * from sales where region in ({{region_param}}) and city in ({{city_param}}). This will create two parameters 1)region_param and 2)city_param.

For the parameter “region_param”, I am using Query Based Dropdown List with query as “select distinct region from Geography”(Gives India and US as result) and for the parameter “city_param”, I am using again Query Based Dropdown List with query as “select distinct city from Geography”(Gives Kolkata,Delhi,New York,Dallas,Houston as result).

So in the query “Sales by Region and City”, I want that when I select “India” in the “region_param” then the values in “city_param” should show only city values related to India(like Kolkata,Delhi but not Dallas,Houston,etc)

I tried many things but of no use…It would be great if you could help me out.

image.png

Redash doesn’t support this exact behavior. To do so you’d need for your Query Based Dropdown List parameter to use a query that also uses parameters which isn’t allowed.

You an do it in two steps by having one query that lets you look at data by country, then link to a query that shows you data by city in that country.

1 Like

Hi Kasim,

Thanks for you reply, but I am new to Redash, could you please let me know how to link the two queries as you said with a small example to achieve my requirement.

Thanks in advance