Page 1 of 1

Query: Age at birth of last child

Posted: 08 Jun 2020 20:55
by gsward
There is a custom query to show the age at the birth of the first child of a parent. Query:Individual ~ Age at Birth of First Child

How do I adapt it to show the age at the birth of the last child of a family?

Thanks.

Graham

Re: Query: Age at birth of last child

Posted: 08 Jun 2020 22:09
by tatewise
The answer is a bit complicated where multiple marriages/partnerships are involved.

So let's deal with the simple case of only one marriage/partnership per person.
On the Columns tab you need to use the following Expressions using the the [last] index:
=AgeAt(%INDI%,%INDI.FAMS[1]>CHIL[last]>BIRT.DATE%)
%INDI.FAMS[1]>CHIL[last]>%
%INDI.FAMS[1]>CHIL[last]>BIRT[1].DATE%

and on the Rows filter tab:
%INDI.FAMS[1]>CHIL[last]>BIRT[1].DATE%

But notice they all refer to INDI.FAMS[1] i.e. the 1st Spouse Family

So if the person had mutiple marriages/partnerships there will be INDI.FAMS[2] and maybe INDI.FAMS[3], etc.
But if you use INDI.FAMS[last] that marriage/partnership may not have any children, but earlier ones might.

However, there is a shortcut that yields the last child from any of the marriages/partnerships.
Replace each FAMS[1]>CHIL[last] with ~CHIL[last] so the first Expression above becomes:
=AgeAt(%INDI%,%INDI.~CHIL[last]>BIRT.DATE%)

In fact the original Query should have used ~CHIL[1] to get 1st child from any marriages/partnerships.

If you want the last child from each separate marriage/partnership then that will need a radically different method.

Re: Query: Age at birth of last child

Posted: 09 Jun 2020 08:31
by gsward
Thanks, Mike.

I wanted to get a histogram from my data to give me the profile of age at the birth of the last child. It just might help me clarify the probable mother of a child with no recorded birth event.

Re: Query: Age at birth of last child

Posted: 09 Jun 2020 09:14
by tatewise
So you need to add a Rows filter to exclude males as only the data for women is relevant.

Re: Query: Age at birth of last child

Posted: 09 Jun 2020 16:17
by gsward
Here is the finished product.

Childbirth probability.jpg
Childbirth probability.jpg (328.53 KiB) Viewed 2405 times