Untitled
unknown
plain_text
a year ago
827 B
9
Indexable
# Set path to the CSV file
$csvPath = "C:\temp\user.csv"
# Import the CSV file
$users = Import-Csv -Path $csvPath
# Group users by 'Functie'
$groupedUsers = $users | Group-Object -Property Functie
# Iterate over each group
foreach ($group in $groupedUsers) {
# Calculate 8% of users for the current function
$totalUsers = $group.Count
$percent8 = [math]::Ceiling($totalUsers * 0.08)
# Get the users already marked as "ok"
$existingOkUsers = $group.Group | Where-Object { $_.Retea_test -eq "ok" }
$existingOkCount = $existingOkUsers.Count
# Calculate the number of additional users needed to reach 8%
$numberToSelect = $percent8 - $existingOkCount
# Ensure the number of additional users to select is at least 0
if ($numberToSelect -lt 0) {
$number
Editor is loading...
Leave a Comment