**Describe the bug**
Filtering after Aggregation breaks column table settings. …
**To Reproduce**
Steps to reproduce the behavior:
1. Go to New -> Questions -> Orders -> Group by User_ID, Product ID -> Summarise by Sum of Tax -> Filter by Sum of Tax greater 0 > Visualize
2. When you visualize this you already notice some strange stuff. Like the Visible Columns User_ID an Product_ID are being shown as hidden columns as well:
<img width="1260" alt="image" src="https://user-images.githubusercontent.com/110378427/217011614-00fe88ae-45c9-4305-9b0b-1e23f25961ca.png">
3. Try to click any plus button and nothing happens
<img width="1217" alt="image" src="https://user-images.githubusercontent.com/110378427/217012171-a8850db9-1e89-42b3-a9dc-55d5df3f2f04.png">
4. If you keep hitting the + button a couple of times you will get an error:
<details><summary>Full stacktrace</summary>
```
[61b30d16-d836-40f7-9b6f-dd06b43c7841] 2023-02-06T16:27:42+01:00 ERROR metabase.query-processor.middleware.catch-exceptions Error processing query: Input to resolve-card-id-source-tables* does not match schema:
[(named {:query {:fields (named (not ("distinct" a-clojure.lang.PersistentVector)) "Distinct, non-empty sequence of Field clauses")}} arg0)]
{:database_id 1,
:started_at #t "2023-02-06T15:27:41.659330Z[GMT]",
:error_type :invalid-query,
:json_query
{:database 1,
:query
{:source-query
{:source-table 2, :breakout [["field" 43 nil] ["field" 36 nil]], :aggregation [["sum" ["field" 42 nil]]]},
:filter [">" ["field" "sum" {:base-type "type/Float"}] 0],
:fields
[["field" 43 nil]
["field" 36 nil]
["field" "sum" {:base-type "type/Float"}]
["field" 43 nil]
["field" "USER_ID" {:base-type "type/Integer"}]]},
:type "query",
:parameters [],
:middleware {:js-int-to-string? true, :add-default-userland-constraints? true}},
:native nil,
:status :failed,
:class clojure.lang.ExceptionInfo,
:stacktrace
["--> query_processor.middleware.fetch_source_query$fn__49503$resolve_card_id_source_tables_STAR___49508.invoke(fetch_source_query.clj:290)"
"query_processor.middleware.fetch_source_query$resolve_card_id_source_tables$fn__49525.invoke(fetch_source_query.clj:306)"
"query_processor.middleware.store$initialize_store$fn__49715$fn__49716.invoke(store.clj:11)"
"query_processor.store$do_with_store.invokeStatic(store.clj:45)"
"query_processor.store$do_with_store.invoke(store.clj:39)"
"query_processor.middleware.store$initialize_store$fn__49715.invoke(store.clj:10)"
"query_processor.middleware.normalize_query$normalize$fn__53762.invoke(normalize_query.clj:22)"
"metabase_enterprise.audit_app.query_processor.middleware.handle_audit_queries$handle_internal_queries$fn__60502.invoke(handle_audit_queries.clj:130)"
"query_processor.middleware.constraints$add_default_userland_constraints$fn__50803.invoke(constraints.clj:53)"
"query_processor.middleware.process_userland_query$process_userland_query$fn__53701.invoke(process_userland_query.clj:145)"
"query_processor.middleware.catch_exceptions$catch_exceptions$fn__54073.invoke(catch_exceptions.clj:167)"
"query_processor.reducible$async_qp$qp_STAR___45514$thunk__45516.invoke(reducible.clj:100)"
"query_processor.reducible$async_qp$qp_STAR___45514.invoke(reducible.clj:106)"
"query_processor.reducible$async_qp$qp_STAR___45514.invoke(reducible.clj:91)"
"query_processor.reducible$sync_qp$qp_STAR___45525.doInvoke(reducible.clj:126)"
"query_processor$process_userland_query.invokeStatic(query_processor.clj:331)"
"query_processor$process_userland_query.doInvoke(query_processor.clj:327)"
"query_processor$fn__55092$process_query_and_save_execution_BANG___55101$fn__55104.invoke(query_processor.clj:342)"
"query_processor$fn__55092$process_query_and_save_execution_BANG___55101.invoke(query_processor.clj:335)"
"query_processor$fn__55136$process_query_and_save_with_max_results_constraints_BANG___55145$fn__55148.invoke(query_processor.clj:354)"
"query_processor$fn__55136$process_query_and_save_with_max_results_constraints_BANG___55145.invoke(query_processor.clj:347)"
"api.dataset$run_query_async$fn__71225.invoke(dataset.clj:69)"
"query_processor.streaming$streaming_response_STAR_$fn__40610$fn__40611.invoke(streaming.clj:162)"
"query_processor.streaming$streaming_response_STAR_$fn__40610.invoke(streaming.clj:161)"
"async.streaming_response$do_f_STAR_.invokeStatic(streaming_response.clj:65)"
"async.streaming_response$do_f_STAR_.invoke(streaming_response.clj:63)"
"async.streaming_response$do_f_async$task__20021.invoke(streaming_response.clj:84)"],
:card_id nil,
:context :ad-hoc,
:error
"Input to resolve-card-id-source-tables* does not match schema: \n\n\t [(named {:query {:fields (named (not (\"distinct\" a-clojure.lang.PersistentVector)) \"Distinct, non-empty sequence of Field clauses\")}} arg0)] \n\n",
:row_count 0,
:running_time 0,
:preprocessed nil,
:ex-data
{:type :schema.core/error,
:value
[{:database 1,
:query
{:source-query
{:source-table 2, :breakout [[:field 43 nil] [:field 36 nil]], :aggregation [[:sum [:field 42 nil]]]},
:filter [:> [:field "sum" {:base-type :type/Float}] 0],
:fields
[[:field 43 nil]
[:field 36 nil]
[:field "sum" {:base-type :type/Float}]
[:field 43 nil]
[:field "USER_ID" {:base-type :type/Integer}]]},
:type :query,
:middleware {:js-int-to-string? true, :add-default-userland-constraints? true},
:info
{:executed-by 1,
:context :ad-hoc,
:query-hash
[73, -51, -64, 4, 64, 90, 43, 117, 74, -100, 53, 112, 30, -15, 39, -123, 52, -16, 64, -97, -25, 105, -97, -54,
-107, 66, 108, 30, 91, -95, 118, -105]},
:constraints {:max-results 10000, :max-results-bare-rows 2000}}],
:error
[(named {:query {:fields (named (not ("distinct" a-clojure.lang.PersistentVector)) "Distinct, non-empty sequence of Field clauses")}} arg0)]},
:data {:rows [], :cols []}}
```
</details>
<img width="1469" alt="image" src="https://user-images.githubusercontent.com/110378427/217012505-cee3926f-26da-4b16-9e0c-3ddd3a449054.png">
**Expected behavior**
I want to be able to add and remove columns
**Information about your Metabase Installation:**
Hitting this error on 1.45.2.1 and `master`