Forum Discussion

erikriesenberg's avatar
erikriesenberg
Frequent Visitor
5 years ago

Previous value in a sequence

I have a dataset with the folllowing data points:

  • unique Student ID (which student took the class)
  • Class ID # (what class did they take)
  • Sequence (what number course was this that they've taken from us 1=first course, 2=second course, 3=third course, etc.)
Student IDClass IDSequence
110144331
110133772
110232211
110156983
110232222

 

What I want to know is if there were 100 students whose first class was Class ID 4433 (Class ID = 4433 AND Sequence = 1), what was the next class they took with us.

 

For example:

Total # of Students with First Class ID 4433
100

 

Total # of Students with Second Class ID 5589Total # of Students with Second Class ID 55890Total # of Students with Second Class ID 5591Total # of Students with Second Class ID 6778
50102515

 

I also want to see third classes and fourth etc.  For each Class ID, I'd also like to see the average number of courses those student's go on to take.

7 Replies

  • Hi,

    How does one interpret the last table?  Please elaborate with a dataset which has more number of rows.

    • erikriesenberg's avatar
      erikriesenberg
      Frequent Visitor

      Ashish,

       

      Thanks for the reply.  I see I didn't do a very good job explaining.  

       

      Maybe it will make more sense if I use more precise data.  

       

      Here's a sample of my data set:

      Student IDSequenceClass
      667241AZ-300 Azure Architect Technologies
      671941CompTIA Cybersecurity Analyst Certification CySA+ (Exam CS0-001)
      671942CompTIA Cybersecurity Analyst (CySA+) Certification (Exam CS0-002)
      684091Excel 2016 - Part 2
      684092Excel 2016 - Part 3
      69766110982 Supporting and Troubleshooting Windows 10
      697662VMware Horizon® 7 - Install, Configure, Manage V7.7
      704481Excel 2016 - Part 2
      704482Outlook 2016 - Part 2
      704483PowerPoint 2016 - Part 2
      72545120341 Core Solutions of Microsoft Exchange Server 2013
      725452AWS Solutions Architect Certification - Associate
      725453AZ-103T00 - Microsoft Azure Administrator
      725454NCTA Cloud Architecture
      725461AWS Solutions Architect Certification - Associate
      725462NCTA Cloud Architecture
      736331Adobe Photoshop CC Part 1 (with Labs)
      742581Custom Course
      755651Office 365 Web Apps (with Skype for Business)
      755652Microsoft Teams
      755653SharePoint - Site Owner with Microsoft Forms and Flow (Modern Experience)
      75565455238 SharePoint Online for Administrators

       

      Student ID 66724 took one course and never returned to take another course.  Student ID 68409 took Excel 2016 - Part 2 and then came back for Part 3 whereas Student ID 70448 also started with Excel 2016 - Part 2 first, but then took Outlook, and then Powerpoint. Both Student started with the same class, but took different subsequent classes.

       

      What I want to be able to see is, for all of the students who took Excel 2016 - Part 2 as their first course:

      1. How many took a second course?

      2. What was the next course they took?  

       

      So if I have a total of 100 people that took Excel 2016 - Part 2 as their first course, how many went on to take Excel 2016 - Part 3, how many went on to take Outlook 2016, and so on. 

       

      Beyond that, if Excel 2016 - Part 2 was their first class, what was their third class, fourth class, etc.  You can see that I have this data and can look at this sequence at the Student ID level, but I want to look at it at the class level.  I want to see if there are certain classes are more likely to follow others based on students past enrollment behaviors.

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi erikriesenberg ,

        I created a sample pbix file(see attachment), please check whether that is what you want.

        1. Create a class dimension table and use the class field of the table as slicer

        2. Create the measures as below to get the count of students which filter the conditions

         

        Tempcount = 
        VAR _count =
            CALCULATE (
                DISTINCTCOUNT ( 'Table'[Class] ),
                ALLEXCEPT ( 'Table', 'Table'[Student ID] )
            )
        VAR _tclass =
            CALCULATE (
                MAX ( 'Table'[Class] ),
                FILTER (
                    ALLEXCEPT ( 'Table', 'Table'[Student ID] ),
                    'Table'[Class] = SELECTEDVALUE ( 'Classes'[Class] )
                )
            )
        RETURN
            CALCULATE (
                DISTINCTCOUNT ( 'Table'[Student ID] ),
                FILTER ( 'Table', _count > 1 && NOT ( ISBLANK ( _tclass ) ) )
            )
        Count of students who take selected class = SUMX(VALUES('Table'[Student ID]),[Tempcount])

         

        If the above one is not your expected result, please provide more details(calculation logic, special examples and screenshot etc.) for it. Thank you.

        Best Regards