I have a CSV file of transactions. I've been looking for a way to group the transactions per week.
I know PowerShell has Group-Object and this works to group everything into individual dates, I'm looking to aggregate things by week.
Thanks in advance!
I'm looking at Transaction Date and wanting to loop over all rows to group things in "7 day" buckets. As an example, from 8/31 to 8/24, then 8/24 to 8/17, and so on.
Sample CSV:
Transaction Date,Posted Date,Card No.,Description,Category,Debit
8/31/2022,9/1/2022,1,Meals on wheels!,a,3.5
8/30/2022,9/1/2022,1,Meals on wheels!,b,3.5
8/30/2022,8/31/2022,1,Meals on wheels!,c,3.5
8/30/2022,8/31/2022,1,Meals on wheels!,a,3.5
8/29/2022,8/31/2022,1,Meals on wheels!,a,3.5
8/29/2022,8/30/2022,1,Meals on wheels!,a,3.5
8/26/2022,8/29/2022,1,Meals on wheels!,b,3.5
8/28/2022,8/29/2022,1,Meals on wheels!,b,3.5
8/27/2022,8/29/2022,1,Meals on wheels!,b,3.5
8/25/2022,8/26/2022,1,Meals on wheels!,b,3.5
8/25/2022,8/26/2022,1,Meals on wheels!,b,3.5
8/23/2022,8/24/2022,1,Meals on wheels!,c,3.5
8/23/2022,8/24/2022,1,Meals on wheels!,c,3.5
8/22/2022,8/23/2022,1,Meals on wheels!,c,3.5
8/21/2022,8/23/2022,1,Meals on wheels!,c,3.5
8/21/2022,8/23/2022,1,Meals on wheels!,a,3.5
8/21/2022,8/22/2022,1,Meals on wheels!,a,3.5
Import-Csv C:\transaction_download.csv | ForEach-Object {
$PSItem.'Transaction Date' | Group-Object
# Here I want to create a group of the dates/transactions +7 days from the first date.
}