Forum Discussion

ataft3's avatar
ataft3
New Member
6 years ago
Solved

Contact Tracing and Reporting

Hi,

 

I am trying to model some basic data relating to contact tracing in a school. The first part of this is trying to determine the number of primary and secondary contacts from a given dataset of course registration data. Presently, it's a single sheet as follows (roughly)

User IDStudent Grad YearStudent First NameStudent Last NameSectionCourse TitleDepartmentSchool YearSchool LevelCourseSection ID
1234562021First 1Last 11Anat & PhysiologyUS Science2020 - 2021Upper111255219
1234572021First 2Last 21AP Calculus ABUS Mathematics & Computer Science2020 - 2021Upper111255131
1234582021First 3Last 31AP Physics 2US Science2020 - 2021Upper111255268
1234592021First 5Last 51AP Physics 2US Science2020 - 2021Upper111255268
1234602021First 6Last 61Cathedral ChoristersUS Music2020 - 2021Upper111259166
1234612021First 7Last 71French 5AUS World Languages2020 - 2021Upper111255034
1234622021First 8Last 81AP Physics 2US Science2020 - 2021Upper111255268

 

I want to be able that students Last 3, 4 and 8 are 1) primary contacts to one another, and 2) run a report by the student (eg. student 3) that shows the primary contacts for her (4 and 8).

 

I hope this makes sense. Thanks in advance.

  • Here is one way to do it.  Make a table visual with Student ID, Last Name, and CourseID.  Add this measure to it, to get the result shown below.

     

    Primary Contacts =
    VAR thisstudent =
        VALUES ( Tracing[Student Last Name] )
    VAR sameclass =
        CALCULATETABLE (
            VALUES ( Tracing[Student Last Name] ),
            ALLEXCEPT ( Tracing, Tracing[CourseSection ID] )
        )
    RETURN
        CONCATENATEX (
            EXCEPT ( sameclass, thisstudent ),
            Tracing[Student Last Name],
            ", "
        )

     

     

    If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

    Regards,

    Pat

2 Replies

  • mahoneypat's avatar
    mahoneypat
    Icon for Microsoft Employee rankMicrosoft Employee

    Here is one way to do it.  Make a table visual with Student ID, Last Name, and CourseID.  Add this measure to it, to get the result shown below.

     

    Primary Contacts =
    VAR thisstudent =
        VALUES ( Tracing[Student Last Name] )
    VAR sameclass =
        CALCULATETABLE (
            VALUES ( Tracing[Student Last Name] ),
            ALLEXCEPT ( Tracing, Tracing[CourseSection ID] )
        )
    RETURN
        CONCATENATEX (
            EXCEPT ( sameclass, thisstudent ),
            Tracing[Student Last Name],
            ", "
        )

     

     

    If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

    Regards,

    Pat

    • mahoneypat's avatar
      mahoneypat
      Icon for Microsoft Employee rankMicrosoft Employee

      Did this work for you ataft3 ?  Please mark it as solution if so.  Kudos appreciated too.

      Regards,

      Pat