title: How to calculate accumulated time for a defined frequency?
body: <p>I have rows containing descriptions of services that have been ordered by our customers.</p>
  
  <p><strong>Table</strong>:
  OrderedServices</p>
  
  <p><strong>Columns</strong>:</p>
  
  <ul>
  <li>Id (key)</li>
  <li>CustomerId</li>
  <li>ServiceId</li>
  <li>StartDate</li>
  <li>EndDate</li>
  <li>AmountOfTimeOrdered (hours)</li>
  <li>IntervalType (month, week or day)</li>
  <li>Interval (integer)</li>
  </ul>
  
  <p>An example:</p>
  
  <pre><code>1;24343;98;2020-01-20;2020-06-05;1.5;day;3
  </code></pre>
  
  <p>The above is read as ”Customer w/ id 24343 has ordered service #98 to be executed 1.5hrs every 3rd day during the period 2020-01-20 up until 2020-06-05”</p>
  
  <p>The first day of execution is always StartDate, so, in the given example, the services is first executed 2020-01-20, followed by 2020-01-23 (20+3), 2020-01-26, 2020-01-29 aso.</p>
  
  <p>Now I want to calculate the total amount of time executed for a given ServiceType for a given time period.</p>
  
  <p>E.g. 2020-01-01 - 2020-01-31 = 4 x 1.5 = 6hrs in total executed time for the above.</p>
  
  <p>What I can’t figure out is how to create a measure, or a calculated table to achieve this.</p>
  
  <p>Does anyone have an idea?</p>
  
  <p>Kind regards,
  Peter</p>