Forum Discussion

lukesi's avatar
lukesi
Copper Contributor
Dec 27, 2025

Calculating hours using pivot table

Hi,

I'm making a personell planning sheet and I want to calculate the sum of hours teachers give lessons. I have 2 tables and my data is formatted like this (simplified)

Lesson nameHoursTeacher 1

Teacher 2

Lesson 1

2Paul

 

Lesson 2

3Pete

 

Lesson 3

2Paul

Pete

 

Teacher nameMax working hours
Paul10
Pete15

Now I want to create an overview of how many hours each teacher is teaching using a pivot table.

This is easy when there is just one Teachter collumn but I need to calculate the sum using both teacher collumns...

 I need to overview to be something like this:

  • Paul -> Lesson 1 + Lesson 3 = 4 hours
  • Pete -> Lesson 2 + lessen 3 = 5 hours

Then the next step is to use a metric or KPI to calculate if each teacher is exceeding their max working hours...

Can anybody hlelp me with these problems?

Thanks!

2 Replies

  • I think you need to make the table like this first. With that dataset it is up to you how you do next steps for your actual needs. Yo

    LessonHoursTeacher
    Lesson 12Paul
    Lesson 23Pete
    Lesson 32Paul
    Lesson 32Pete

    1. Convert the Lesson table to a Table

    Select any cell in the Lesson table

    Press Ctrl + T

    Confirm “My table has headers”



    2. Load into Power Query

    With the table selected

    Go to Data → From Table/Range (Power Query Editor opens)


    3. Unpivot the Teacher columns

    Hold Ctrl

    Select Teacher 1 and Teacher 2

    Right-click → Unpivot Columns

     



    4. Clean up

    Delete the Attribute column

    Rename Value → Teacher

     

    Close and load

     


     

  • mathetes's avatar
    mathetes
    Gold Contributor

    Your inquiry has been up for several days without a reply. I can't speak for others with certainty, but from my perspective I suspect that the reason for the lack of replies is that the sample data you do give is far too simple. Far too simple to create a Pivot Table from; so in effect you're asking anybody who might want to offer assistance to create their own more complete set of data. 

    You would help us help you by posting a more representative set of data (still no real names) with multiple teachers, multiple classes, etc. If you're not able to attach an actual Excel workbook to your reply in this forum, put it onto Google Sheets or the equivalent and paste a link here. 

Resources