[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-08-25。"],[],[],null,["# Blending example: Classes, students, and grades\n\nSuppose you are a school administrator and that you store information about the classes offered, the students who enroll in those classes, and the grades they receive in each class. You can use Looker Studio to track and visualize this information by using data blending.\n| **See a demonstration report** : Copy and edit a [live demonstration report](https://lookerstudio.google.com/reporting/edb8c110-6946-4054-a287-8fe65fcce8f6/page/r7vQ) to see how blending works. (This report is available only in English.)\n\nQuestions to answer\n-------------------\n\nThis example answers the following questions that you might have about the data:\n\n- Which students took which classes, and what grade did each student receive in each class?\n- What was the highest grade received in each class?\n- Which student received the highest grade in each class?\n\nSample data\n-----------\n\nHere's the data used in the examples.\n\n**Classes**:\n\n**Students**:\n\n**Grades**:\n\n| **Tip:** Follow along with the examples in this document by making a copy of this data using [Google Sheets](https://docs.google.com/spreadsheets/d/1v74etUJflbLMfrfmlyAH2wFS99rcsVJrrRF6YmIAsW4/edit?usp=sharing).\n\nSetup\n-----\n\nThe first step is to connect to your data by creating data sources in Looker Studio. The demonstration report uses Sheets for the underlying data, but you could also store this data in a database, such as BigQuery or MySQL.\n\n1. Create a new report.\n2. Add 3 data sources corresponding to the sample data:\n 1. Classes\n 2. Students\n 3. Grades\n\nLearn how to [create and edit data sources](/looker/docs/studio/about-data-sources).\n\nQuestion 1: Students, classes, and grades received\n--------------------------------------------------\n\n**Question**: \"Which students took which classes, and what grade did each student receive in each class?\"\n\nTo answer this question, follow these steps:\n\n1. Create a new blend.\n2. Add a **Grades** table with the following dimensions:\n 1. `student_id`\n 2. `class_id`\n 3. `grade`\n3. Add a **Students** table with the following dimensions:\n 1. `student_id`\n 2. `student_name`\n4. Add a **Classes** table with the following dimensions:\n 1. `class_id`\n 2. `class_name`\n5. Join **Grades** to **Students** with `student_id`.\n6. Join **Grades** to **Classes** with `class_id`.\n7. Set both join operations to left outer.\n8. Save the blend and close the editor.\n9. Add a table to the report with the `student_name`, `class_name`, and `grade` fields.\n10. Sort the table by `student_name`, descending.\n\nYour table should look like this:\n\nQuestion 2: Highest grade by class\n----------------------------------\n\n**Question**: \"What was the highest grade received in each class?\"\n\nTo answer this question, follow these steps:\n\n1. Use the same blend as in [Question 1](#question_1).\n2. Add a table to the report.\n3. Add `class_name` as a dimension and `grade` as a metric.\n4. Edit the `grade` field as follows:\n 1. Change the name to `max_grade`.\n 2. Set the aggregation to **MAX**.\n5. Sort the table by `max_grade`, descending.\n\nYour table should look like this:\n\nQuestion 3: Highest grade by student by class\n---------------------------------------------\n\n**Question**:\"Which student received the highest grade in each class?\"\n\nTo answer this question, follow these steps:\n\n1. Create a new blend.\n2. Add a **Classes** table with the following dimensions:\n 1. `class_id`\n 2. `class_name`\n3. Add a **Grades** table, name it **Grades 1** , and add dimension `class_id`.\n4. Add `grade` as a metric, and set the aggregation to **MAX**.\n5. Rename `grade` to `max_grade`.\n6. Add the **Grades** table again, name it **Grades 2** , and add dimensions:\n 1. `student_id`\n 2. `class_id`\n 3. `grade`\n7. Add a **Students** table, with dimensions:\n 1. `student_id`\n 2. `student_name`\n8. Use **left outer** for each join.\n9. Join **Classes** to **Grades** with `class_id`.\n10. Join **Grades** to **Grades 2** with:\n 1. `class_id = class_id`\n 2. `max_grade = grade`\n11. Join **Grades 2** to **Students** with `student_id`.\n\n12. Save the blend and close the editor.\n\n13. Add a table to the report with the `student_name`, `class_name`, and `max_grade` fields.\n\nYour table should look like this:"]]