Forum Discussion
alexsvi
5 years agoRegular Visitor
Calculated column to find first parent
Hi,
Lets say I have this :
| ID | ParentID | Name | Firts parent Name |
| 1 | 0 | Name1 | Name1 |
| 2 | 0 | Name2 | Name2 |
| 3 | 1 | Name3 | Name1 |
| 4 | 1 | Name4 | Name1 |
| 5 | 2 | Name5 | Name2 |
| 6 | 3 | Name6 | Name1 |
| 7 | 5 | Name7 | Name2 |
How do I achive the last column as a calculated column?
Thanks!
2 Replies
- amitchandak
Super User
alexsvi , Try a new column like
coalesce(maxx(filter(table, [ID] =earlier([parent_id])),[name]),[Name])
- alexsviRegular Visitor
I actually need to "go up" until I have a 0 in parent_id. I can have more than 5-6 layers in reality.
I tried your code and it almost work, but some doesnt "climb" to the top parent