'Select the most detailed level in Power Bi

I've been struggling to find a way to aggregate hierarchal data with my data set. My data already has the sums on every level. I need a way to display this data while allowing for drill throughs on the various levels. Additionally, not every path on my hierarchy goes out to the same level. My thought is to have a column that displays the most granular level in every path. I need a way to dynamically identify the "most detailed level in path" as seen in the picture below. Thanks!

enter image description here



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source