Get value of the field Count after piping to Group

I am writing a little function that grabs books I have in Goodreads and lets me know which series I haven’t finished but I’m stuck with getting the total amount of books I have for a series.

I have all my books and series titles in a variable $MyBooks

I am running this

$Group = $MyBooks | Group -Property series_overview_title
Which gives me this

Count Name


1 The First Law First Law World
155
1 The Elder Stones Saga
2 Mage Errant
5 No Series Found
4 The Divine Dungeon
6 Cradle
1 Weapons and Wielders
4 The Landkist Saga
1 Song of the Worlds
1 Evermen Saga

But when I try to write the value of $Group.count it gives me the total line items of $Group
How can I get the value of count for just the line that I want when it has the same name as the method?
This is the whole section that has what I have been trying
$MyBooks = foreach ($Book in $AllBooksInfo) {
$URL="https://www.goodreads.com/work/$($Book.work.id)/series?format=xml&key=$($API_key)"
$Response=Invoke-WebRequest-Uri $URL-Method Get -UseBasicParsing
[XML]$series_overview_XML=$Response.Content
[INT]$series_overview_work_id=$series_overview_XML.GoodreadsResponse.series_works.series_work.series.id| Select -First 1
[INT]$series_overview_primary_work_count=$series_overview_XML.GoodreadsResponse.series_works.series_work.series.primary_work_count| Select -First 1
if($series_overview_XML.GoodreadsResponse.series_works.series_work.series.title."#cdata-section"){
[STRING]$series_overview_title=($series_overview_XML.GoodreadsResponse.series_works.series_work.series.title."#cdata-section").trim()
}
else{[STRING]$series_overview_title='No Series Found'}
[pscustomobject]@{
id=$Book.id.'#text'
title_without_series=$Book.id.title_without_series
title=$Book.title
small_image_url=$Book.small_image_url
large_image_url=$Book.large_image_url
link=$Book.link
description=$Book.description
work_id=$Book.work.id
author_image_url=$Book.authors.author.image_url
author_small_image_url=$Book.authors.author.small_image_url
author_id=$Book.authors.author.id
series_overview_XML=$series_overview_XML
series_overview_title=$series_overview_title
series_overview_primary_work_count=$series_overview_primary_work_count
series_overview_work_id=$series_overview_work_id
owned_books_in_series="0"
}
Start-Sleep-Seconds 1
$i++
Write-Output"$i of $($AllBooksInfo.count)"
}
$Group = $MyBooks | Group -Property series_overview_title | Select Count,Name
$Obj = @()
foreach($itemin$Group){
foreach($Bookin$MyBooks){
$Book.owned_books_in_series=$item.Count
$Obj+=$Book
}
}
$Obj

Actually, that’s not very clear.

$Group.count would just give me the total.

$Group[4].count would give me the int ‘5’

but when I try to write that value ($item.count) into my object (via the foreach) it gives me $Group.count instead of $item.count

I realised now that I could have just renamed the property but I still can’t get the count of items into the original object.

I still want to get a count of how many items in my object have the same series_overview_title and write that total into owned_books_in_series but i can’t for the life of me work it out.

$Group = $MyBooks | Group -Property series_overview_title | Select-Object -Property @{Name = 'Total'; Expression = { $_.count } }, Name, Group
$Obj = @()
foreach ($Book in $MyBooks) {
foreach($Linein$Group){
$Value_I_Want=$Line.Total|Where{$Line.name-like$Book.series_overview_title}
}
$Book.owned_books_in_series=$Value_I_Want
$Book.owned_books_in_series
$Obj+=$Book
}
$Obj.owned_books_in_series