<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Calculating Occupied beds across multiple months in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-Occupied-beds-across-multiple-months/m-p/2249815#M54099</link>
    <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="343049" data-lia-user-login="MIrlam" class="lia-mention lia-mention-user"&gt;MIrlam&lt;/a&gt; , A measure like &lt;/P&gt;
&lt;P&gt;Countrows(filter(Table, datediff([admission date],[date of discharge],1) &amp;gt; 0 ))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;or&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Countrows(filter(Table, Eomonth([admission date],0)&amp;lt;eomonth([date of discharge],0)&amp;nbsp; ))&lt;/P&gt;</description>
    <pubDate>Tue, 21 Dec 2021 11:48:29 GMT</pubDate>
    <dc:creator>amitchandak</dc:creator>
    <dc:date>2021-12-21T11:48:29Z</dc:date>
    <item>
      <title>Calculating Occupied beds across multiple months</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-Occupied-beds-across-multiple-months/m-p/2249733#M54094</link>
      <description>&lt;P&gt;Hi all&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a table with date of admission and date of discharge in it. I can calculate the bed occupancy quite easily for people who arrive and leave in the same month. I have custom columns to work out occupancy for people who arrive one month and leave the next which all works. What I can't work out is how to calculate the ones who arrive one month and stay the next (maybe next 2) months. I have tried using if formulas with date diffs and previous and next month expressions but can't work it out!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ideally and what I've tried to get to work is, I would like one column to work out if the datediff between month of discharge and month of admission is &amp;gt;=2 then add the count of days from the month before discharge to my column&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hopefully I'm on the right lines&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 21 Dec 2021 11:02:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-Occupied-beds-across-multiple-months/m-p/2249733#M54094</guid>
      <dc:creator>MIrlam</dc:creator>
      <dc:date>2021-12-21T11:02:31Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating Occupied beds across multiple months</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-Occupied-beds-across-multiple-months/m-p/2249815#M54099</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="343049" data-lia-user-login="MIrlam" class="lia-mention lia-mention-user"&gt;MIrlam&lt;/a&gt; , A measure like &lt;/P&gt;
&lt;P&gt;Countrows(filter(Table, datediff([admission date],[date of discharge],1) &amp;gt; 0 ))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;or&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Countrows(filter(Table, Eomonth([admission date],0)&amp;lt;eomonth([date of discharge],0)&amp;nbsp; ))&lt;/P&gt;</description>
      <pubDate>Tue, 21 Dec 2021 11:48:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-Occupied-beds-across-multiple-months/m-p/2249815#M54099</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2021-12-21T11:48:29Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating Occupied beds across multiple months</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-Occupied-beds-across-multiple-months/m-p/2250051#M54118</link>
      <description>&lt;P&gt;Thanks but I don't think I want countrows, I tried it using the first expression and it just returned 2884 in every row in the column.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Dec 2021 13:28:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-Occupied-beds-across-multiple-months/m-p/2250051#M54118</guid>
      <dc:creator>MIrlam</dc:creator>
      <dc:date>2021-12-21T13:28:21Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating Occupied beds across multiple months</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-Occupied-beds-across-multiple-months/m-p/2254850#M54406</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="343049" data-lia-user-login="MIrlam" class="lia-mention lia-mention-user"&gt;MIrlam&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;Here are the steps you can follow：&lt;/P&gt;
&lt;P&gt;1. Create calculated column.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Flag = DATEDIFF(EOMONTH('Table'[date_hospitalized],-1)+1,EOMONTH('Table'[date_Discharged],0),MONTH)&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;day =
IF('Table'[Flag] &amp;gt;=2,DATEDIFF('Table'[date_hospitalized],'Table'[date_Discharged],DAY),0)&lt;/LI-CODE&gt;
&lt;P&gt;2. Result:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Liu Yang&lt;/P&gt;
&lt;P&gt;If this post &lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider &lt;EM&gt;Accept it as the solution&lt;/EM&gt; to help the other members find it more quickly&lt;/P&gt;</description>
      <pubDate>Fri, 24 Dec 2021 06:50:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-Occupied-beds-across-multiple-months/m-p/2254850#M54406</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-12-24T06:50:00Z</dc:date>
    </item>
  </channel>
</rss>

