<?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: Help with DATEADD function in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-with-DATEADD-function/m-p/4015129#M158205</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="677229" data-lia-user-login="seefadeeb" class="lia-mention lia-mention-user"&gt;seefadeeb&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use the Date table:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;DATEADD ( 'Date'[Date], -1, MONTH )&lt;/LI-CODE&gt;
&lt;P&gt;When you use above formula, Power BI can correctly understand dates and their relationships because Date is a specialized date table that is connected to the Sales table by a relationship.&lt;BR /&gt;The Date table contains a contiguous and complete set of dates, which helps the DATEADD function work correctly and return the expected results.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Use Order Date in the Sales table:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;DATEADD ( Sales[Order Date], -1, MONTH )&lt;/LI-CODE&gt;
&lt;P&gt;When you use above formula, the function may not work as expected because Sales[Order Date] does not provide a continuous set of dates. It only contains dates with sales transactions.&lt;BR /&gt;DATEADD relies on a continuous date range to calculate the offset date. Since Sales[Order Date] may have gaps and not cover every date, this causes the DATEADD function to return null values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Adamk Kong&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;helps&lt;/STRONG&gt;&lt;/EM&gt;, then please consider&lt;EM&gt;&lt;STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;Accept it as the solution&lt;/STRONG&gt;&lt;/EM&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;to help the other members find it more quickly.&lt;/P&gt;</description>
    <pubDate>Fri, 28 Jun 2024 08:38:39 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2024-06-28T08:38:39Z</dc:date>
    <item>
      <title>Help with DATEADD function</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-with-DATEADD-function/m-p/4011089#M157868</link>
      <description>&lt;P&gt;I wrote the DATEADD dax function as below&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;EM&gt;Previous Month = CALCULATE(SUM(Sales[Sales Amount]),DATEADD('Sales'[Order Date],-1,MONTH))&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;It is not giving the desired result as in the below screenshot. It is returning blank rows in months&lt;/DIV&gt;&lt;DIV&gt;&lt;img /&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;A href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/52518" target="_blank"&gt;@Fowmy&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/148838" target="_blank"&gt;@amitchandak&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/362560" target="_blank"&gt;@Ahmedx&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/457209" target="_blank"&gt;@Ritaf1983&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 26 Jun 2024 10:50:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-with-DATEADD-function/m-p/4011089#M157868</guid>
      <dc:creator>seefadeeb</dc:creator>
      <dc:date>2024-06-26T10:50:25Z</dc:date>
    </item>
    <item>
      <title>Re: Help with DATEADD function</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-with-DATEADD-function/m-p/4011206#M157874</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="677229" data-lia-user-login="seefadeeb" class="lia-mention lia-mention-user"&gt;seefadeeb&lt;/a&gt;, Hope you are doing good!&lt;BR /&gt;&lt;BR /&gt;Your DAX formula looks correct, You have to check few things as it's not working fine.&lt;BR /&gt;&lt;BR /&gt;1) Firstly please check the data type of the order date column, it should be Date type&lt;/P&gt;&lt;P&gt;2) If you are using a date table and using the year &amp;amp; month column in visual from date table, then please verify that there should be an active relationship between order date and date column.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope this will help you!&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;&lt;STRONG&gt;Did I answer your question? Mark my post as a solution! Appreciate your Kudos !!&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Jun 2024 11:55:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-with-DATEADD-function/m-p/4011206#M157874</guid>
      <dc:creator>anmolmalviya05</dc:creator>
      <dc:date>2024-06-26T11:55:49Z</dc:date>
    </item>
    <item>
      <title>Re: Help with DATEADD function</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-with-DATEADD-function/m-p/4012886#M158029</link>
      <description>&lt;P&gt;The order date is date type and there is not date table. How can i send the PBIX file to you to verify?&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jun 2024 07:42:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-with-DATEADD-function/m-p/4012886#M158029</guid>
      <dc:creator>seefadeeb</dc:creator>
      <dc:date>2024-06-27T07:42:28Z</dc:date>
    </item>
    <item>
      <title>Re: Help with DATEADD function</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-with-DATEADD-function/m-p/4013011#M158041</link>
      <description>&lt;P&gt;Thanks for the reply from &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="693617" data-lia-user-login="anmolmalviya05" class="lia-mention lia-mention-user"&gt;anmolmalviya05&lt;/a&gt;&amp;nbsp;, please allow me to provide another insight:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="677229" data-lia-user-login="seefadeeb" class="lia-mention lia-mention-user"&gt;seefadeeb&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Check your data model, especially the field types and inter-table relationships for the date table. In my test, using the same formula, it shows up fine.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Sales Amount = SUMX ( Sales, Sales[Quantity] * Sales[Net Price] )&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;PM Sales = CALCULATE ( [Sales Amount], DATEADD ( 'Date'[Date], -1, MONTH ) )&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Adamk Kong&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;helps&lt;/STRONG&gt;&lt;/EM&gt;, then please consider&lt;EM&gt;&lt;STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;Accept it as the solution&lt;/STRONG&gt;&lt;/EM&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jun 2024 08:51:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-with-DATEADD-function/m-p/4013011#M158041</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-06-27T08:51:24Z</dc:date>
    </item>
    <item>
      <title>Re: Help with DATEADD function</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-with-DATEADD-function/m-p/4013327#M158070</link>
      <description>&lt;P&gt;Thanks for the reply Anonymous&lt;/a&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the PBIX file you attached, if i change the formula as below without using date table I am getting blanks&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;PM Sales =&lt;/SPAN&gt; &lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt; ( &lt;/SPAN&gt;&lt;SPAN&gt;[Sales Amount]&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;DATEADD&lt;/SPAN&gt;&lt;SPAN&gt; ( &lt;/SPAN&gt;&lt;SPAN&gt;Sales&lt;/SPAN&gt;&lt;SPAN&gt;[Order Date]&lt;/SPAN&gt;&lt;SPAN&gt;, -&lt;/SPAN&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;MONTH&lt;/SPAN&gt;&lt;SPAN&gt; ) )&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;img /&gt;&lt;P&gt;Can you explain this behaviour?&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 27 Jun 2024 11:25:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-with-DATEADD-function/m-p/4013327#M158070</guid>
      <dc:creator>seefadeeb</dc:creator>
      <dc:date>2024-06-27T11:25:54Z</dc:date>
    </item>
    <item>
      <title>Re: Help with DATEADD function</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-with-DATEADD-function/m-p/4015129#M158205</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="677229" data-lia-user-login="seefadeeb" class="lia-mention lia-mention-user"&gt;seefadeeb&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use the Date table:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;DATEADD ( 'Date'[Date], -1, MONTH )&lt;/LI-CODE&gt;
&lt;P&gt;When you use above formula, Power BI can correctly understand dates and their relationships because Date is a specialized date table that is connected to the Sales table by a relationship.&lt;BR /&gt;The Date table contains a contiguous and complete set of dates, which helps the DATEADD function work correctly and return the expected results.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Use Order Date in the Sales table:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;DATEADD ( Sales[Order Date], -1, MONTH )&lt;/LI-CODE&gt;
&lt;P&gt;When you use above formula, the function may not work as expected because Sales[Order Date] does not provide a continuous set of dates. It only contains dates with sales transactions.&lt;BR /&gt;DATEADD relies on a continuous date range to calculate the offset date. Since Sales[Order Date] may have gaps and not cover every date, this causes the DATEADD function to return null values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Adamk Kong&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;helps&lt;/STRONG&gt;&lt;/EM&gt;, then please consider&lt;EM&gt;&lt;STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;Accept it as the solution&lt;/STRONG&gt;&lt;/EM&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jun 2024 08:38:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-with-DATEADD-function/m-p/4015129#M158205</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-06-28T08:38:39Z</dc:date>
    </item>
  </channel>
</rss>

