<?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: Error with DateAdd in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Error-with-DateAdd/m-p/2463470#M66814</link>
    <description>&lt;P&gt;So, I used PREVIOUSMONTH with the month column of my calendar table and the PM Sales (&lt;SPAN&gt;PM Sales = CALCULATE(SUM(Sales[Sales]), PREVIOUSMONTH (Time[Month])) works well and i don't get an error when i am changing the time periode on the slicer.&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The only problem now is that i get either wrong row total or no row total at all.&lt;BR /&gt;&lt;BR /&gt;Do you know can i fix this?? I am sooooo close!!&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 19 Apr 2022 11:34:33 GMT</pubDate>
    <dc:creator>Dimitris_Kats</dc:creator>
    <dc:date>2022-04-19T11:34:33Z</dc:date>
    <item>
      <title>Error with DateAdd</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Error-with-DateAdd/m-p/2462801#M66757</link>
      <description>&lt;P&gt;Dear members Hello&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am calculating the Current Month Sales amount:&lt;/P&gt;&lt;P&gt;CM Sales = CALCULATE(SUM(Sales[Sales]))&lt;/P&gt;&lt;P&gt;Also the Previous Month Sales&lt;/P&gt;&lt;P&gt;PM Sales = CALCULATE(SUM(Sales[Sales]), DATEADD(Time[Month], -1, Month))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And last i am checking if there are any changes on sales amount month by month&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sales Dif = IF(ISBLANK([CM Sales]), BLANK(),IF(ISBLANK([PM Sales]),blank(), IF([CM Sales] = [PM Sales], BLANK(), [CM Sales] - [PM Sales]))))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This measures works well and it gives me the desired results. If there are new products that doesn't have any sales yet i get them as blank rows.&lt;/P&gt;&lt;P&gt;When i am trying though to add a Filter to remove tha BLANK rows (Sales Dif is not BLANK)&amp;nbsp; i get an error that DATEADD expects a contiguous selection.&lt;/P&gt;&lt;P&gt;I am using a calendar table and the problem is when I select on my slicer months of previous year.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there any way to fix this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Apr 2022 07:15:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Error-with-DateAdd/m-p/2462801#M66757</guid>
      <dc:creator>Dimitris_Kats</dc:creator>
      <dc:date>2022-04-19T07:15:34Z</dc:date>
    </item>
    <item>
      <title>Re: Error with DateAdd</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Error-with-DateAdd/m-p/2462889#M66769</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="324110" data-lia-user-login="Dimitris_Kats" class="lia-mention lia-mention-user"&gt;Dimitris_Kats&lt;/a&gt; , You should always use a date table for that &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PM Sales = CALCULATE(SUM(Sales[Sales]), DATEADD(Date[Date], -1, Month))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;refer&lt;/P&gt;
&lt;P&gt;Why Time Intelligence Fails - Powerbi 5 Savior Steps for TI :&lt;A href="https://youtu.be/OBf0rjpp5Hw" target="_blank"&gt;https://youtu.be/OBf0rjpp5Hw&lt;/A&gt;&lt;BR /&gt;&lt;A href="https://amitchandak.medium.com/power-bi-5-key-points-to-make-time-intelligence-successful-bd52912a5bd4" target="_blank"&gt;https://amitchandak.medium.com/power-bi-5-key-points-to-make-time-intelligence-successful-bd52912a5bd4&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :&lt;A href="https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions" target="_blank"&gt;radacad&lt;/A&gt; &lt;A href="https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/" target="_blank"&gt;sqlbi&lt;/A&gt; &lt;A href="https://www.youtube.com/playlist?list=PLPaNVDMhUXGYLz-w8ERQOo3KYARs7GgG-" target="_blank"&gt;My Video Series&lt;/A&gt; Appreciate your Kudos. &lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Apr 2022 07:49:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Error-with-DateAdd/m-p/2462889#M66769</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2022-04-19T07:49:17Z</dc:date>
    </item>
    <item>
      <title>Re: Error with DateAdd</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Error-with-DateAdd/m-p/2462911#M66771</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="148838" data-lia-user-login="amitchandak" class="lia-mention lia-mention-user"&gt;amitchandak&lt;/a&gt;&amp;nbsp; and thank you very much for your reply.&lt;/P&gt;&lt;P&gt;I am using a date table for this measure . I use the month column from the date table wich is formatted as date.&amp;nbsp;&lt;BR /&gt;This is not the problem &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Apr 2022 08:00:55 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Error-with-DateAdd/m-p/2462911#M66771</guid>
      <dc:creator>Dimitris_Kats</dc:creator>
      <dc:date>2022-04-19T08:00:55Z</dc:date>
    </item>
    <item>
      <title>Re: Error with DateAdd</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Error-with-DateAdd/m-p/2463101#M66784</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="324110" data-lia-user-login="Dimitris_Kats" class="lia-mention lia-mention-user"&gt;Dimitris_Kats&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The explanation provided by&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="148838" data-lia-user-login="amitchandak" class="lia-mention lia-mention-user"&gt;amitchandak&lt;/a&gt;&amp;nbsp;is correct. DATEADD deals with a column of unique date values. The month column even if formatted as date is not unique. Use the date column with DATEADD or YearMonth Number column and subtract 1&lt;/P&gt;</description>
      <pubDate>Tue, 19 Apr 2022 09:15:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Error-with-DateAdd/m-p/2463101#M66784</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-04-19T09:15:10Z</dc:date>
    </item>
    <item>
      <title>Re: Error with DateAdd</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Error-with-DateAdd/m-p/2463256#M66796</link>
      <description>&lt;P&gt;Thank you very much&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="317289" data-lia-user-login="tamerj1" class="lia-mention lia-mention-user"&gt;tamerj1&lt;/a&gt;&amp;nbsp; for your reply.&lt;/P&gt;&lt;P&gt;Unfortunatelly when i use the calendar date I don't get results at all.&lt;/P&gt;&lt;P&gt;I tried to use instead of the DATEADD the PREVIOUSMONTH but i don't get correct results and i don't get results by month.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't know what is wrong&lt;/P&gt;</description>
      <pubDate>Tue, 19 Apr 2022 09:58:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Error-with-DateAdd/m-p/2463256#M66796</guid>
      <dc:creator>Dimitris_Kats</dc:creator>
      <dc:date>2022-04-19T09:58:20Z</dc:date>
    </item>
    <item>
      <title>Re: Error with DateAdd</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Error-with-DateAdd/m-p/2463470#M66814</link>
      <description>&lt;P&gt;So, I used PREVIOUSMONTH with the month column of my calendar table and the PM Sales (&lt;SPAN&gt;PM Sales = CALCULATE(SUM(Sales[Sales]), PREVIOUSMONTH (Time[Month])) works well and i don't get an error when i am changing the time periode on the slicer.&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The only problem now is that i get either wrong row total or no row total at all.&lt;BR /&gt;&lt;BR /&gt;Do you know can i fix this?? I am sooooo close!!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Apr 2022 11:34:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Error-with-DateAdd/m-p/2463470#M66814</guid>
      <dc:creator>Dimitris_Kats</dc:creator>
      <dc:date>2022-04-19T11:34:33Z</dc:date>
    </item>
    <item>
      <title>Re: Error with DateAdd</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Error-with-DateAdd/m-p/2463650#M66829</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="324110" data-lia-user-login="Dimitris_Kats" class="lia-mention lia-mention-user"&gt;Dimitris_Kats&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry just noticed your reply. Would you pleas share a screenshot of you date table?&lt;/P&gt;</description>
      <pubDate>Tue, 19 Apr 2022 13:15:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Error-with-DateAdd/m-p/2463650#M66829</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-04-19T13:15:33Z</dc:date>
    </item>
    <item>
      <title>Re: Error with DateAdd</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Error-with-DateAdd/m-p/2470903#M67273</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="324110" data-lia-user-login="Dimitris_Kats" class="lia-mention lia-mention-user"&gt;Dimitris_Kats&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try to sumx your original measure to get correct result in total.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;PM Sales with correct Total = SUMX(VALUES('Time'[Month]),[PM Sales])&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;Sales Dif with correct Total = SUMX(VALUES('Time'[Month]),[Sales Dif])&lt;/LI-CODE&gt;
&lt;P&gt;Result is as below.&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;BR /&gt;Rico Zhou&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Apr 2022 08:10:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Error-with-DateAdd/m-p/2470903#M67273</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-04-22T08:10:40Z</dc:date>
    </item>
  </channel>
</rss>

