Remapping Not Working in Question

  • In Metabase, I created a foreign key relationship between a Students table and a Schools table. In the MySQL database, both these tables are actually views derived from the same Users table, with a self-joined foreign key between Parent ID and User ID.

  • In the Students table, I remapped the School ID field to display the school name from the foreign key relationship, instead of displaying the ID.

  • As you can see in the following screenshot, this worked fine:

Students

  • Next, I created a question based on the Placements table, which has a foreign key relationship with Students. The question is supposed to display the number of placements, grouped by school. I selected the same Students->School field as the group by, but as you can see in the following screenshot, it’s grouping by the School ID, not the school name.

Students%20by%20School

Since the School field was remapped to lookup the school’s name, I don’t understand why this question is grouping by the school ID instead of its name.

{
  "browser-info": {
    "language": "en-US",
    "platform": "Win32",
    "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4309.0 Safari/537.36 Edg/88.0.698.0",
    "vendor": "Google Inc."
  },
  "system-info": {
    "file.encoding": "UTF-8",
    "java.runtime.name": "OpenJDK Runtime Environment",
    "java.runtime.version": "11.0.9+11",
    "java.vendor": "AdoptOpenJDK",
    "java.vendor.url": "https://adoptopenjdk.net/",
    "java.version": "11.0.9",
    "java.vm.name": "OpenJDK 64-Bit Server VM",
    "java.vm.version": "11.0.9+11",
    "os.name": "Linux",
    "os.version": "5.4.0-1018-aws",
    "user.language": "en",
    "user.timezone": "America/New_York"
  },
  "metabase-info": {
    "databases": [
      "mysql"
    ],
    "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": "2020-10-26",
      "tag": "v0.37.0.2",
      "branch": "release-x.37.x",
      "hash": "ba7be09"
    },
    "settings": {
      "report-timezone": "US/Eastern"
    }
  }
}

Hi @bkonia
I think I’m missing the context - you should now be able to post more screenshots.
Also, please post “Diagnostic Info” from Admin > Troubleshooting.

Updated the original post

@bkonia Can you show a screenshot of the Notebook editor, since the issue you’re describing was fixed in 0.36.8, but I don’t understand why you’re getting “Student -> School” unless you’re doing some joins or selecting the wrong field.
This is similar setup with Sample Dataset:

See the screenshot below. I haven’t created any joins in the question; the relationships are all established in the Data Model screen.

Placements is joined to Students and Students is joined to Schools. This report is showing placements by school. Since Placements is not directly joined to Schools and since I want a distinct count of Students placed by school, I’m using Students as the intermediary table.

@bkonia They are implicit joins, because you have linked the tables in the Data Model. If you create manual joins, then we call those explicit joins. Metabase looks simple on the surface, but everything gets really complex, when you look under the hood.
But you’re essentially asking for this, which haven’t had a lot of attention sadly:
https://github.com/metabase/metabase/issues/10945 - upvote by clicking :+1: on the first post

Yes, that’s exactly what I’m looking for. Thank you for pointing me to the Github issue. I’ve upvoted it!