Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
I've a question regarding counting of children inside a hierarchy.
I have 2 fields: ID and ParentID.
I have to create a chart with ID as a dimension, and an expression that would count the number of children associated to the ParentID.
So, for example, if I have a table of IDs and ParentIDs
| ID | ParentID |
|---|---|
| 90 | 100 |
| 80 | 100 |
| 70 | 100 |
| 60 | 70 |
| 100 | - |
I wanted to have a resulting table chart like this:
| ID | Children |
|---|---|
| 100 | 3 |
| 90 | 0 |
| 80 | 0 |
| 70 | 1 |
| 60 | 0 |
How can I accomplish this task without writing load scripts?
I tried the expression:
count({<ParentID=ID>} ID)
but without any success.
Thanks.
Regards,
Valera
New chart (table type) -> add dimension ParentID -> add expression "=Count( Children )"
And uncheck "Supress zero values".
Well, I can't do that because all my tables are connected through the field ID and not ParentID. So, I am forced to insert ID as my dimension if I want to add also other related fields from different tables like Name, Date, PurchaseValue etc.
Any ideas?