title: Create DAX to count number of occupied rooms per calendar date in Power BI
body: <p>I am trying to count the number of "Occupied rooms" per calendar date.</p>
  
  <p>so if there was say 6 reserves with diffrent "DateIN" and "DateOUT" I would be able to calculate how many rooms occupied there was every day. I have done this by using a column formula - but I need it to be a measure in order to be filtered by slicers.</p>
  
  <p>Here is a simple example of what I would need:</p>
  
  <pre><code>BOOKINGID                     DateIN               DateOUT
  
  000001                       01-01-2017          06-01-2017
  
  000002                       01-01-2017          03-01-2017
  
  000003                       02-01-2017          03-01-2017
  
  000004                       03-01-2017          05-01-2017
  
  000005                       08-01-2017          10-01-2017
  </code></pre>
  
  <p></p>
  
  <pre><code>DATE                     OCCUPIEDROOMS
  
  01-01-2017                          2
  
  02-01-2017                          3
  
  03-01-2017                          3
  
  04-01-2017                          2
  
  05-01-2017                          2
  
  06-01-2017                          1
  
  07-01-2017                          0
  
  08-01-2017                          1
  
  09-01-2017                          1
  
  10-01-2017                          1
  </code></pre>
  
  <p>here is a the formula i used to do this as a column:</p>
  
  <blockquote>
    <p>OcupacionHL = CALCULATE(count(F_Reservas[Reservas]); FILTER(F_Reservas;
    (F_Reservas[Fecha Inicio] &lt;= D_Calendario[FECHA]) &amp;&amp; (F_Reservas[Fecha
    Fin] >= D_Calendario[FECHA])); F_Reservas[Hotel] = "Hotel 1")</p>
  </blockquote>
  
  <p>And here is an image of my data model:
  <a href="https://i.stack.imgur.com/xDd9a.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xDd9a.png" alt="data model"></a></p>