For SQL based question there are parameters that can be used to filter nested query.
{{my_filter}} can be added in the query + linked from the dashboard. Even if the my_filter column does not appear in the final result.
When switching to a query build with visual query editor (a nested query with custom expression and a saved question) only the two columns that appear in the final output are available to be selected as filters from the dashboard.
I'm unsure whether what I'm trying to do is supported but I found a couple of issue that make me think it should:
opened 07:43PM - 27 Sep 19 UTC
closed 10:10AM - 24 Oct 20 UTC
Reporting/Dashboards
Querying/Parameters & Variables
Querying/Nested Queries
.Completeness
.Reproduced
**Describe the bug**
When creating a Custom question and doing filter aggregati… on on returned data (generating a sub-select), then dashboard filters cannot be connected to card.
**Workaround**
Include another question with the same columns, which isn't aggregated, and also connect the filters to that question. That will make the dashboard filters show correctly.
**To Reproduce**
1. Create Custom question from Sample Data > Orders
2. Filter `User ID = 1`, Summarize `Sum of Total` grouped by `Created At: Day` and `Product ID` and `Product -> Category`
3. Aggregation filter `sum is greater than 100`

4. Save question and add to dashboard
5. Add filters `Time: All options` and `ID` and `Other Categories` and try to connect to question.
<details>
<summary>Generated SQL - click to expand</summary>
SELECT "source"."CREATED_AT" AS "CREATED_AT", "source"."PRODUCT_ID" AS "PRODUCT_ID", "source"."CATEGORY" AS "CATEGORY", "source"."sum" AS "sum"
FROM (SELECT CAST("PUBLIC"."ORDERS"."CREATED_AT" AS date) AS "CREATED_AT", "PUBLIC"."ORDERS"."PRODUCT_ID" AS "PRODUCT_ID", "PRODUCTS__via__PRODUCT_ID"."CATEGORY" AS "CATEGORY", sum("PUBLIC"."ORDERS"."TOTAL") AS "sum" FROM "PUBLIC"."ORDERS"
LEFT JOIN "PUBLIC"."PRODUCTS" "PRODUCTS__via__PRODUCT_ID" ON "PUBLIC"."ORDERS"."PRODUCT_ID" = "PRODUCTS__via__PRODUCT_ID"."ID"
WHERE "PUBLIC"."ORDERS"."USER_ID" = 1
GROUP BY CAST("PUBLIC"."ORDERS"."CREATED_AT" AS date), "PUBLIC"."ORDERS"."PRODUCT_ID", "PRODUCTS__via__PRODUCT_ID"."CATEGORY"
ORDER BY CAST("PUBLIC"."ORDERS"."CREATED_AT" AS date) ASC, "PUBLIC"."ORDERS"."PRODUCT_ID" ASC, "PRODUCTS__via__PRODUCT_ID"."CATEGORY" ASC) "source" WHERE "source"."sum" > 100
LIMIT 1048576
</details>
**Expected behavior**
Ability to do filtering via dashboard.
**Information about your Metabase Installation:**
Metabase 0.33.3 and release-0.33.x
**Additional context**
See forum thread for real database queries:
https://discourse.metabase.com/t/multiple-filters-in-dashboards/7487
Related to #9802 and #12654
:arrow_down: Please click the :+1: reaction instead of leaving a `+1` or `update?` comment
I believe that not all columns are available is related two the second custom column, if I remove it, all columns are available. As soon as I add it, only the two custom columns are available.