If we can agree that the data source contains one row for each item sold(?), and each row contains all the data, then something like this will produce the desired result:
$dataSource = Import-CSV C:\Junk\DPD.csv
$OutFile = 'C:\Junk\DPD.txt'
$key = ""
$OneShot = $true
For ($i=0; $i -lt $dataSource.Length; $i++){
If($OneShot){
$key = $dataSource[$i].Order
$OneShot = $false
$dataSource[$i].Order,$dataSource[$i].Date,$dataSource[$i].Name -join "," | Out-File $OutFile
}
if ($key -ne $dataSource[$i].Order){
$key = $dataSource[$i].Order
$dataSource[$i].Order,$dataSource[$i].Date,$dataSource[$i].Name -join "," | Add-Content $OutFile
}
$dataSource[$i].Order,$dataSource[$i].SKU,$dataSource[$i].Desc,$dataSource[$i].Price -join "," | Add-Content $OutFile
}
The input to that code was this file:
Order,Date,Name,SKU,Desc,Price
2039489,25-01-2021,Mrs Smith,SKU987,Kitchen Utensils,£3.00
2039489,25-01-2021,Mrs Smith,SKU934,Knife,£5.00
2039460,25-01-2021,Mr Smith,SKU47,Calendar,£6.00
2039460,25-01-2021,Mr Smith,SKU87,Stationary,£2.00
And the output was:
2039489,25-01-2021,Mrs Smith
2039489,SKU987,Kitchen Utensils,£3.00
2039489,SKU934,Knife,£5.00
2039460,25-01-2021,Mr Smith
2039460,SKU47,Calendar,£6.00
2039460,SKU87,Stationary,£2.00