<?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 Dynamic date calculation for getting current month data. in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dynamic-date-calculation-for-getting-current-month-data/m-p/2919099#M95692</link>
    <description>&lt;P&gt;&lt;FONT face="georgia,palatino" size="3"&gt;Hello experts,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="georgia,palatino" size="3"&gt;I want to make my dates dynamic as per the current month.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="georgia,palatino" size="3"&gt;Previously I was hard coding values as,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="georgia,palatino" size="3"&gt;Example:&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;FONT face="georgia,palatino" size="3"&gt;&lt;EM&gt;MTD Rev = CALCULATE(SUM('Table'[Revenue]), 'Table'[Period]=DATE(2022,11,01))&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="georgia,palatino" size="3"&gt;&lt;SPAN&gt;Now, Instead of hardcode I have inserted filter condition as,&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="georgia,palatino" size="3"&gt;&lt;SPAN&gt;Example:&amp;nbsp;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;FONT face="georgia,palatino" size="3"&gt;&lt;EM&gt;MTD Rev&amp;nbsp; = CALCULATE(SUM('Table'[Revenue]), &lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="georgia,palatino" size="3"&gt;&lt;EM&gt;FILTER('Table',MONTH('Table'[Period]) = MONTH(TODAY())),&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="georgia,palatino" size="3"&gt;&lt;EM&gt;FILTER('Table',YEAR('Table'[Period]) = YEAR(TODAY())))&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="georgia,palatino" size="3"&gt;Today() is working fine in my case but it is going to fail as month will change! &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="georgia,palatino" size="3"&gt;Because today will take system date and I need my formula to work according to the working days in a current month.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="georgia,palatino" size="3"&gt;Kindly guide me to replace today() by working days as per current month.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="georgia,palatino" size="3"&gt;Note: Max of date won't work as we are having future dates till 2024.&lt;/FONT&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Mon, 21 Nov 2022 15:04:18 GMT</pubDate>
    <dc:creator>liberty20</dc:creator>
    <dc:date>2022-11-21T15:04:18Z</dc:date>
    <item>
      <title>Dynamic date calculation for getting current month data.</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dynamic-date-calculation-for-getting-current-month-data/m-p/2919099#M95692</link>
      <description>&lt;P&gt;&lt;FONT face="georgia,palatino" size="3"&gt;Hello experts,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="georgia,palatino" size="3"&gt;I want to make my dates dynamic as per the current month.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="georgia,palatino" size="3"&gt;Previously I was hard coding values as,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="georgia,palatino" size="3"&gt;Example:&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;FONT face="georgia,palatino" size="3"&gt;&lt;EM&gt;MTD Rev = CALCULATE(SUM('Table'[Revenue]), 'Table'[Period]=DATE(2022,11,01))&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="georgia,palatino" size="3"&gt;&lt;SPAN&gt;Now, Instead of hardcode I have inserted filter condition as,&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="georgia,palatino" size="3"&gt;&lt;SPAN&gt;Example:&amp;nbsp;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;FONT face="georgia,palatino" size="3"&gt;&lt;EM&gt;MTD Rev&amp;nbsp; = CALCULATE(SUM('Table'[Revenue]), &lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="georgia,palatino" size="3"&gt;&lt;EM&gt;FILTER('Table',MONTH('Table'[Period]) = MONTH(TODAY())),&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="georgia,palatino" size="3"&gt;&lt;EM&gt;FILTER('Table',YEAR('Table'[Period]) = YEAR(TODAY())))&lt;/EM&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="georgia,palatino" size="3"&gt;Today() is working fine in my case but it is going to fail as month will change! &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="georgia,palatino" size="3"&gt;Because today will take system date and I need my formula to work according to the working days in a current month.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="georgia,palatino" size="3"&gt;Kindly guide me to replace today() by working days as per current month.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="georgia,palatino" size="3"&gt;Note: Max of date won't work as we are having future dates till 2024.&lt;/FONT&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 21 Nov 2022 15:04:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dynamic-date-calculation-for-getting-current-month-data/m-p/2919099#M95692</guid>
      <dc:creator>liberty20</dc:creator>
      <dc:date>2022-11-21T15:04:18Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic date calculation for getting current month data.</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dynamic-date-calculation-for-getting-current-month-data/m-p/2919127#M95695</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="369913" data-lia-user-login="liberty20" class="lia-mention lia-mention-user"&gt;liberty20&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My suggestion is to:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1) Create a nice Calendar Table that you can connect to you "Fact" table&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/power-bi/guidance/model-date-tables" target="_blank"&gt;https://learn.microsoft.com/en-us/power-bi/guidance/model-date-tables&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2) Use Time intelligence functions to calculate Sales MTD, QTD, YTD etc. Please find below and example:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sales MTD = Calculate(&lt;BR /&gt;Sum(Sales_values),&lt;/P&gt;&lt;P&gt;DATESMTD(Date_Table[Day])&lt;BR /&gt;)&lt;/P&gt;</description>
      <pubDate>Mon, 21 Nov 2022 15:15:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dynamic-date-calculation-for-getting-current-month-data/m-p/2919127#M95695</guid>
      <dc:creator>Uspace87</dc:creator>
      <dc:date>2022-11-21T15:15:57Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic date calculation for getting current month data.</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dynamic-date-calculation-for-getting-current-month-data/m-p/2964127#M98852</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Thank you &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="472983" data-lia-user-login="Uspace87" class="lia-mention lia-mention-user"&gt;Uspace87&lt;/a&gt;, above formula is working great for MTD calculations&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Could you please suggest the same for non mtd calculations such as below:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Fcast TPD =&lt;BR /&gt;VAR FcastTotalTonnes = CALCULATE(SUM('Budget'[Tonnes]), 'Budget'[Date] = DATE(2022,12,01))&lt;BR /&gt;VAR WDcurrentMonth = CALCULATE(AVERAGE('Budget'[WDAYS]),'Budget'[Date] = DATE(2022,12,01))&lt;BR /&gt;return&lt;BR /&gt;DIVIDE(FcastTotalTonnes,WDcurrentMonth,0)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In above formula you can see&amp;nbsp;&lt;SPAN&gt;'Budget'[Date] = DATE(2022,12,01) is the static date which we need to manually change when every new month starts.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Kindly suggest an idea to make above measure dynamic.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Dec 2022 04:59:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dynamic-date-calculation-for-getting-current-month-data/m-p/2964127#M98852</guid>
      <dc:creator>liberty20</dc:creator>
      <dc:date>2022-12-13T04:59:17Z</dc:date>
    </item>
  </channel>
</rss>

