Hi Experts,

I have a table with columns like this

```
ID Description P_ID
201 P
202 B 201
203 B 201
204 B 201
205 P
206 B 205
207 B 205
```

It is the P_ID which determines child relationship with the parent. So 202,203,204 are children of 201 hence count 3. Similarly 206 and 207 are children of 205 hence count is 2

```
ID Description Parent Qty Child Qty
201 P 1 3
205 P 1 2
```

I tried to create two groups i) P_ID ii) ID and calculated the sum but I am getting ‘5’ instead of individual for each group (3 and 2). Please advise how can I achieve this. Any help will be greatly appreciated.

Thanks!!