title: How to hide blanks in a matrix visualization with hierarchical rows
body: <p>I've built a table of data following this helpful guide: 
  <a href="https://www.daxpatterns.com/parent-child-hierarchies/" rel="nofollow noreferrer">https://www.daxpatterns.com/parent-child-hierarchies/</a></p>
  
  <p>I'm following it exactly but I'll still explain things here so you don't have to go through the whole article if you don't want to. I have a table of Names with corresponding keys, and ParentKeys forming hierarchies.
  I added a column for the path, columns for each level of the path, depth of hierarchy and an IsLeaf column:</p>
  
  <p><a href="https://i.stack.imgur.com/H9Jtu.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/H9Jtu.png" alt="Table of data"></a></p>
  
  <p>If I want to make a matrix and include City (from another table), all hierarchies will expand to the maximum length, and blanks are filled in with the "parent's" name:</p>
  
  <p><a href="https://i.stack.imgur.com/SxUYt.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/SxUYt.png" alt="enter image description here"></a></p>
  
  <hr>
  
  <p>The DAX Patterns website explains how to get around this. First add these two measures:</p>
  
  <pre><code>BrowseDepth = ISFILTERED (Nodes[Level1]) + ISFILTERED (Nodes[Level2]) + ISFILTERED (Nodes[Level3])
  </code></pre>
  
  <pre><code>MaxNodeDepth = MAX (Nodes[HierarchyDepth])
  </code></pre>
  
  <p>And then you can factor that into calculations with this measure:</p>
  
  <pre><code>Sales Amount Simple = 
  IF (
      Nodes[BrowseDepth] &gt; Nodes[MaxNodeDepth],
      BLANK (),
      SUM (Transactions[Amount])
  )
  </code></pre>
  
  <p>If this is the only value on a matrix visual, it turns out fine:</p>
  
  <p><a href="https://i.stack.imgur.com/n7lk5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/n7lk5.png" alt="enter image description here"></a></p>
  
  <p>But if I add any other values, I get expanded hierarchies and blanks again:</p>
  
  <p><a href="https://i.stack.imgur.com/x194a.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/x194a.png" alt="enter image description here"></a></p>
  
  <p>My problem would be solved if I could filter out blank values, but that filters out the entire hierarchy. Do I have to make a measure using the Sales Amount format above for every value I want to include? I'm trying to add things like addresses that can't be aggregated.</p>