title: Accurately calculating business hours between two time stamps in Web Intelligence
body: <p>I am trying to calculate the number of working / business hours between two timestamps at the report level in <strong>Web Intelligence</strong>.</p>
  
  <p>So far, I have been able to calculate the total number of hours between the two dates, the total # of business days excluding weekends.</p>
  
  <p>Method for business days:</p>
  
  <pre><code>Business Days variable = [Days Between Assignment + Completion]-(2 * [# of weekends])
  
  Days between variable := TimeBetween([Assignment Date / Time];[Completion Date / Time];DayPeriod)
  
  Calculate weekends := DaysBetween(LastDayOfWeek(Min([Assignment Date / Time]));LastDayOfWeek([Completion Date / Time])) / 7
  </code></pre>
  
  <p>Variables created:</p>
  
  <ul>
  <li>BusinessStartTime = <code>8:00 AM</code> </li>
  <li>BusinessEndTime = <code>5:00 PM</code></li>
  <li>BusinessDaysBetweenStartandEnd</li>
  <li>TimeBetweenStartandEnd</li>
  </ul>
  
  <p>The difficulty is getting the calculations to only count between the business hours of <code>8:00 AM</code> and <code>5:00 PM</code>.</p>
  
  <p>Example timestamps of both objects:</p>
  
  <p><strong>Start time:</strong> <code>Sep 27, 2019 7:53:27 AM</code><br>
  <strong>Completion time:</strong> <code>Oct 9, 2019 2:29:24 PM</code></p>
  
  <p>Using SAP BusinessObjects BI Platform 4.2, and the report I am creating is being done through Web Intelligence.</p>