Pivot Table showing just averages

SandsB

Well-known Member
Joined
Feb 13, 2007
Messages
736
Office Version
  1. 365
Platform
  1. Windows
Column A = Technician ID
Column B = Patient Record ID
Column C = Record Age (Number of days since Patient Record was created)
Column D = Days Remaining (Number of days before Patient Record needs to be closed

There are a couple dozen Technicians and each could have anywhere from 10 to 50+ Patient Records in the input file. I need a report that shows, in one row, Technician ID, Total Number of Patient Records assigned to the Technician, Average Record Age, Average Days Remaining.

I can do a pivot table that gives me all this data but what I need is a report that shows one row per Technician with just the other 3 fields. I just don't see a way to make all the data for each agent appear on only 1 row.
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Hello! If I understand you correctly, this can be done using Power Query
Book1.xlsm
ABCD
10Technician IDPatient Record IDRecord AgeDays Remaining
11Technician_1Patient_123
12Technician_1Patient_254
13Technician_2Patient_142
14Technician_2Patient_233
15Technician_2Patient_384
16Technician_2Patient_452
17Technician_2Patient_595
18Technician_2Patient_653
19Technician_3Patient_141
20Technician_3Patient_262
21Technician_3Patient_354
22Technician_3Patient_425
23Technician_3Patient_512
24Technician_3Patient_615
25Technician_3Patient_783
26Technician_3Patient_844
27Technician_3Patient_943
28Technician_3Patient_1023
Sheet10

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table10"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Technician ID", type text}, {"Patient Record ID", type text}, {"Record Age", Int64.Type}, {"Days Remaining", Int64.Type}}),
    #"Grouped Rows" = Table.Group(#"Changed Type", {"Technician ID"}, {{"Total Number of Patient Records", each Table.RowCount(_), Int64.Type}, {"Average Record Age", each List.Average([Record Age]), type nullable number}, {"Average Days Remaining", each List.Average([Days Remaining]), type nullable number}})
in
    #"Grouped Rows"
Book1.xlsm
ABCD
1Technician IDTotal Number of Patient RecordsAverage Record AgeAverage Days Remaining
2Technician_123,53,5
3Technician_265,6666666673,166666667
4Technician_3103,73,2
Table10
 
Upvote 0
This can be done in a pivot table, as well. I placed tech ID in the row label, and each of the other three columns in the Values section, changing count to average for the record age and days remaining.

1729547586588.png
 
Upvote 0
Didn't know I could do that. Thank you so much!
 
Upvote 0
Sergius - I went the other way but you started me down the road of Power Queries. I can see where I'll use this a lot. Thank you.
 
Upvote 0

Forum statistics

Threads
1,224,813
Messages
6,181,115
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top