<?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 How to get correct count of number of days till today in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-get-correct-count-of-number-of-days-till-today/m-p/1653492#M33655</link>
    <description>&lt;P&gt;I need to create a measure Average Discharges per Day, its formula is Total Discharges at any point in time date divided by number of days in that point in time.&amp;nbsp;&lt;/P&gt;&lt;P&gt;But I am not getting the correct results due to incorrect denominator.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For eg. If I want to see the discharges in Calendar Year 2021 and upto today i.e. 9 Feb the calculation would be Total Discharges till 09-Feb-21 divided by 40(31 [days in Jan] + 9[days in Feb]).&amp;nbsp;But whatever calculation I use, ends up counting 28 days for Feb in the denominator, which becomes 59 days instead of 40, thus lowering the average.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I have tried below three different calculations to get the right denominator, but all of these are counting 28 days in Feb instead of counting days in Feb till today i.e. 9th Feb :&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;COUNTROWS(CALCULATETABLE(DATESYTD('Date'[Date],"30/06"))) --- Wherein the Date is the date calendar in out model.&lt;/LI&gt;&lt;LI&gt;TOTALYTD(COUNTROWS('Date'),'Date'[Date],"6/30")&lt;/LI&gt;&lt;LI&gt;CALCULATE(INT(MAX('Date'[Date]) - MIN('Date'[Date]) + 1))&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;How to get the count of dates only till current date in the denomintor.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here the time period selected can be in terms of Financial Year instead of Calenday Year, still the denominator should be counting the days from 01-July-2020 till 09-Feb-2021 if current financial year is selected.&lt;/P&gt;</description>
    <pubDate>Tue, 09 Feb 2021 02:49:33 GMT</pubDate>
    <dc:creator>RachnaV</dc:creator>
    <dc:date>2021-02-09T02:49:33Z</dc:date>
    <item>
      <title>How to get correct count of number of days till today</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-get-correct-count-of-number-of-days-till-today/m-p/1653492#M33655</link>
      <description>&lt;P&gt;I need to create a measure Average Discharges per Day, its formula is Total Discharges at any point in time date divided by number of days in that point in time.&amp;nbsp;&lt;/P&gt;&lt;P&gt;But I am not getting the correct results due to incorrect denominator.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For eg. If I want to see the discharges in Calendar Year 2021 and upto today i.e. 9 Feb the calculation would be Total Discharges till 09-Feb-21 divided by 40(31 [days in Jan] + 9[days in Feb]).&amp;nbsp;But whatever calculation I use, ends up counting 28 days for Feb in the denominator, which becomes 59 days instead of 40, thus lowering the average.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I have tried below three different calculations to get the right denominator, but all of these are counting 28 days in Feb instead of counting days in Feb till today i.e. 9th Feb :&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;COUNTROWS(CALCULATETABLE(DATESYTD('Date'[Date],"30/06"))) --- Wherein the Date is the date calendar in out model.&lt;/LI&gt;&lt;LI&gt;TOTALYTD(COUNTROWS('Date'),'Date'[Date],"6/30")&lt;/LI&gt;&lt;LI&gt;CALCULATE(INT(MAX('Date'[Date]) - MIN('Date'[Date]) + 1))&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;How to get the count of dates only till current date in the denomintor.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here the time period selected can be in terms of Financial Year instead of Calenday Year, still the denominator should be counting the days from 01-July-2020 till 09-Feb-2021 if current financial year is selected.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Feb 2021 02:49:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-get-correct-count-of-number-of-days-till-today/m-p/1653492#M33655</guid>
      <dc:creator>RachnaV</dc:creator>
      <dc:date>2021-02-09T02:49:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to get correct count of number of days till today</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-get-correct-count-of-number-of-days-till-today/m-p/1653654#M33660</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="234910" data-lia-user-login="RachnaV" class="lia-mention lia-mention-user"&gt;RachnaV&lt;/a&gt; , Try a measure like&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Avg YTD Sales = &lt;BR /&gt;divide(CALCULATE(SUM(Sales[Sales Amount]),DATESYTD('Date'[Date],"12/31")),CALCULATE(countx(filter(values('Date'[Date]), not(isblank(calculate(SUM(Sales[Sales Amount]))))),'Date'[Date])))&lt;/P&gt;</description>
      <pubDate>Tue, 09 Feb 2021 04:37:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-get-correct-count-of-number-of-days-till-today/m-p/1653654#M33660</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2021-02-09T04:37:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to get correct count of number of days till today</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-get-correct-count-of-number-of-days-till-today/m-p/1656447#M33721</link>
      <description>&lt;P&gt;Measure that is working with all filters :&lt;/P&gt;&lt;P&gt;Thanks for the help and for responding with the solution. It was working fine if the only filters applied on report were from Date table but any filter on Hospital name or ward name was breaking the measure.&amp;nbsp; I was able to come up with the measure that worked fine with all the different filters on report.&lt;/P&gt;&lt;P&gt;It is :&lt;/P&gt;&lt;P&gt;NumberOfDays :=&amp;nbsp;&lt;/P&gt;&lt;P&gt;VAR MaxDate = MAX('Date'[Date])&lt;BR /&gt;VAR CurrentDate = TODAY()&lt;/P&gt;&lt;P&gt;RETURN&lt;BR /&gt;IF ( MaxDate &amp;gt;= CurrentDate,&lt;BR /&gt;COUNTROWS(CALCULATETABLE('Date', FILTER('Date','Date'[Date] &amp;lt; CurrentDate))),&lt;BR /&gt;COUNTROWS('Date')&lt;BR /&gt;)&lt;/P&gt;</description>
      <pubDate>Wed, 10 Feb 2021 04:37:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-get-correct-count-of-number-of-days-till-today/m-p/1656447#M33721</guid>
      <dc:creator>RachnaV</dc:creator>
      <dc:date>2021-02-10T04:37:19Z</dc:date>
    </item>
  </channel>
</rss>

