i have a csv file with following informations and want to use powershell to reach my goal. Every month i create this report and i want to group it and sum up the total pages.
Date & Time | Full Name | Printer Name | Total Pages |
---|---|---|---|
21.10.2021 17:15:15 | User One | Printer HP | 13 |
21.10.2021 17:25:34 | User One | Printer Dell | 5 |
21.10.2021 17:38:05 | User Two | Printer HP | 9 |
In the end, i want to see which user printed on what printer how many total pages over a month.
So i use the group-object 'Full Name',Printer Name' but how can i sum up the total pages according to that group?
Best regards, Manuel
Measure-Object can be used to sum, average, minimum and maximum
Import-Csv C:\ps\sampled.csv | Group-Object 'Full Name' |
Select-Object 'Name', @{ n='Total Pages'; e={ ($_.Group | Measure-Object 'Total Pages' -Sum).Sum } }
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.