title: How to calculate based on different levels of a hierarchy - Power BI
body: <p>Take the following matrix;</p>
  
  <p><a href="https://i.stack.imgur.com/67YjM.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/67YjM.jpg" alt="matrix"></a></p>
  
  <p>I need to know how to perform calculations on different levels of a hierarchy. </p>
  
  <p>Say the Customer Service is Level2 of the hierarchy. (Level 1 being client)</p>
  
  <p>The <strong>STDEVP.1_Duration</strong> is the Standard deviation measure on the duration column values. So as per the image above I need to add a new column beside it where it takes the <strong>Duration</strong> and subtracts the <strong>STDEVP.1_duration</strong> of the level above. So in the example above for Customer Service, Total = 22194891 - 406 = 22194485.</p>
  
  <p>How can this be achieved? </p>