Using Field Filters for SQL Questions on Dashboard

Hi there,
Currently I have a Dashboard that has a 4-5 tiles that use the following Tables (all joined together):

  • Time_Subitem
  • Time_Item
  • Task
  • Resource
  • Project
  • Account
  • Territory
  • Role
  • Department Resource
  • Department

On the Dashboard, we use the following filters (have included which tables they're from too):

  • Project Number [from "Project" Table]
  • Project ID [from "Project" Table]
  • Department Name [Referenced as "Team", from the "Department" Table]
  • Project Start Date [from "Project" table]
  • Task Resource [Referenced as "Full Name" from the "Resource Table"]
  • Task Date Worked [From the "Time Subitem" table]
  • Region [From the "Territory" Table]

The User wanted to use their own table for Hourly Rates, so, we created a SQL CASE statement amending this, the Query is as follows [I've removed Names and Numbers from the CASE statement]:

I've tried to use the Field Filters from SQL Variables in line 53, and have connected them with their respective Tables and Columns. However, when I join these to the existing filters on the Dashboard, and then try and run the Dashboard using filters, I am getting the SQL Error:

"The Multi-Part Identifier "dbo.wh_department.department_name" could not be bound".

At this stage I'm pretty stuck with a solution, but also the best practice here.

Diagnostic Info as follows:

{
"browser-info": {
"language": "en-GB",
"platform": "MacIntel",
"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.114 Safari/537.36",
"vendor": "Google Inc."
},
"system-info": {
"file.encoding": "UTF-8",
"java.runtime.name": "OpenJDK Runtime Environment",
"java.runtime.version": "11.0.10+9-Ubuntu-0ubuntu1.20.04",
"java.vendor": "Ubuntu",
"java.vendor.url": "https://ubuntu.com/",
"java.version": "11.0.10",
"java.vm.name": "OpenJDK 64-Bit Server VM",
"java.vm.version": "11.0.10+9-Ubuntu-0ubuntu1.20.04",
"os.name": "Linux",
"os.version": "5.4.0-70-generic",
"user.language": "en",
"user.timezone": "Etc/UTC"
},
"metabase-info": {
"databases": [
"postgres",
"sqlserver"
],
"hosting-env": "unknown",
"application-database": "h2",
"application-database-details": {
"database": {
"name": "H2",
"version": "1.4.197 (2018-03-18)"
},
"jdbc-driver": {
"name": "H2 JDBC Driver",
"version": "1.4.197 (2018-03-18)"
}
},
"run-mode": "prod",
"version": {
"date": "2021-04-20",
"tag": "v0.39.0.1",
"branch": "release-x.39.x",
"hash": "47bb5f2"
},
"settings": {
"report-timezone": "UTC"
}
}
}

Hi @NTR
You cannot use table aliases with Field Filters.
https://www.metabase.com/learn/building-analytics/sql-templates/field-filters.html
https://www.metabase.com/docs/latest/users-guide/13-sql-parameters.html#the-field-filter-variable-type