Forum Discussion
AGo
Post Patron
6 years agoFirst hierarchical nonblank value
Hello, I've got a table with these columns: ParentID(text), ID(text), Attribute(text). For each ID I need the first upper hierarchical non-blank Attribute to be returned in a calculated column. e...
Anonymous
6 years agoNot applicable
First, in PBI the only way to implement parent-child hierarchies is to expand them to fixed-depth hierarchies. I hope you're aware of this. So you have to flatten the hierarchy. Once you've got this flat structure, it should be pretty easy to achieve what you want by very standard means.
For how to turn a parent-child hierarchy into a flattened one please find an article on www.sqlbi.com. Just type "parent child" into the search box and you should be presented with a handful of articles.
Also, please remember that you can unpivot your structure into a second (hidden) table and from such a table it should be easy to calculate what you want.
Best
D