Getting ready

To prepare for this recipe, do the following:

  1. Open Power BI Desktop.
  2. Use an Enter Data query to create a table called R02_Students with the following data:

Teacher

Student

Teacher A

Student 1

Teacher A

Student 2

Teacher A

Student 3

Teacher A

Student 4

Teacher B

Student 1

Teacher B

Student 5

Teacher B

Student 7

Teacher B

Student 8

Teacher C

Student 3

Teacher C

Student 4

Teacher C

Student 7

Teacher C

Student 8

Teacher D

Student 5

Teacher D

Student 9

Teacher D

Student 10

  1. Create the following tables:
R02_Teachers1 = DISTINCT('R02_Students'[Teacher])

R02_Teachers2 = DISTINCT('R02_Students'[Teacher])
  1. Ensure that a one-to-many relationship exists between the R02_Teachers1 and R02_Students tables.
  2. Ensure that a one-to-many relationship exists between the R02_Teachers2 and R02_Students tables.
  3. Ensure that no other relationships between the R02_Students, R02_Teachers1, and R02_Teachers2 tables exist.

The data in the R02_Students table contains a list of teachers and their students. We wish to identify the number of students that teachers have in common. In addition, we also wish to identify the students that teachers do not share.