how do i create a pivot table for this MOM by agent AHT

Carrie Ward 80 Reputation points
2025-08-26T15:04:45.81+00:00

User's image

Microsoft 365 and Office | Excel | For business | Windows
0 comments No comments
{count} votes

Accepted answer
  1. Hendrix-C 2,050 Reputation points Microsoft External Staff Moderator
    2025-08-26T16:05:24.2566667+00:00

    Hello @Carrie Ward

    Thank you for reaching out to Microsoft Q&A.  

    According to your request, I will guide you to create a pivot table based on the data you shared: 

    1-Reorganize data 

    Your current layout has agents and AHT values spread across months in separate columns. For a pivot table, I recommend normalizing the data into a single table:   User's image

    2-Convert data 

    If AHT is in time format, Excel will treat it as text. Therefore, you need to convert it to general numerical format (hours, minutes, seconds) for calculations. For example, I convert it to minute format  

    User's image

    3-Insert and configure pivot table 

    Now, select the entire table (including headers) > Insert > PivotTable > from table/range > choose place for pivot table. You can configure the Pivot Table area based on your need. I will demonstrate with agent as rows, month as columns and AHT as values 

    User's image I hope this information is helpful. If there's anything else I can help you with, please feel free to reach out again.  

    Hope to hear from you soon.


     If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment”.     

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


3 additional answers

Sort by: Most helpful
  1. Carrie Ward 80 Reputation points
    2025-08-26T16:20:15.2766667+00:00

    User's image


  2. Carrie Ward 80 Reputation points
    2025-08-26T17:11:41.46+00:00

    Step 1 is not looking like yoursUser's image


  3. Ashish Mathur 99,595 Reputation points Volunteer Moderator
    2025-08-26T23:40:56.17+00:00

    Hi,

    This M code in Power Query will transform your data into a 3 column structure.

    let
        Source = Excel.CurrentWorkbook(){[Name="Data"]}[Content],
        Extractheaders = Table.AddColumn(Source, "Months", each List.Transform(List.Select(Record.FieldNames(_), each not Text.Contains(_,"AH")), each {_})),
        Groupsof2 = Table.AddColumn(Extractheaders, "Custom", each List.Split(List.RemoveLastN(Record.ToList(_),1),2)),
        #"Added Custom" = Table.AddColumn(Groupsof2, "Custom.1", each Table.FromRows(List.Transform(List.Zip({[Months],[Custom]}), each List.Combine(_)),{"Month","Agent","AHT"}))[[Custom.1]],
        #"Expanded Custom.2" = Table.ExpandTableColumn(#"Added Custom", "Custom.1", {"Month", "Agent", "AHT"}, {"Month", "Agent", "AHT"}),
        #"Changed Type" = Table.TransformColumnTypes(#"Expanded Custom.2",{{"Month", type text}, {"Agent", type text}, {"AHT", type time}})
    in
        #"Changed Type"
    
    
    

    User's image

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.