intake class student_id
Sep 2022 - Eng English 100
Sep 2022 - Eng English 101
Nov 2022 - Sc Science 100
Jan 2023 - Bio Biology 101
Nov 2022 - Sc Science 102
Sep 2022 - Eng English 102
Jan 2023 - Bio Biology 102
Jan 2023 - Bio Biology 103
Jan 2023 - Bio Biology 105
Feb 2023 - Eng English 104
Feb 2023 - Eng English 103
Hello everyone,
I have a table as shown above. Each row in the table represent the student who is going to attend the classes. For example by looking at the Sep 2022 English class, I know that students with ID 100,101,102 are going to attend the class, and student 100,102 are going to attend Nov 2022 Science class, etc...
What I want to do is to transform the table into another format where it tells how many students did not attend or are not going to attend other classes among the students that are attending the class right now. The table below is the expected output:
I will show how to get the value in the table that are shown in the screenshot:
For example
When student 100,101,102 are attending the Sep 2022 English class, among three of them:
- None of them did not attend or not going to attend English class (as they are attending the English class right now);
- One of them did not attend or not going to attend science class (student
101) since only student100,102are in the list of science class; - One of them did not attend or not going to attend biology class
(student
100) since only student101,102are in the list to attend biology class and student100is not in the list.
Hence, for Sep 2022 - Eng intake:
- no_english = 0
- no_science = 1
- no_biology = 1
Giving another example
When student 101,102,103,105 are attending the Jan 2023 Biology class, among 4 of them:
- One of them did not attend or not going to attend English class (student
105) since student101,102attended Sep 2022 English class and student103going to attend Feb 2023 English class; - three of them did not attend or not going to attend science class (student
101,103,105) since only student102are in the list of science class; - None of them did not attend or not going to attend biology class since all of them are attending Biology class right now.
Hence, for Jan 2023 - Bio intake:
- no_english = 1
- no_science = 3
- no_biology = 0
I have been struggled to transform the data into the desired format like what I show in the screenshot. In fact, I'm not sure whether it is possible to do it or not using powerquery or DAX. Any help or advise will be greatly appreciated. Let me know if my question is not clear.

