<?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: DAX MTD &amp;amp; Prior Year in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-MTD-amp-Prior-Year/m-p/1021228#M13213</link>
    <description>&lt;A href="https://www.sqlbi.com/tv/time-intelligence-in-microsoft-power-bi/" target="_blank"&gt;https://www.sqlbi.com/tv/time-intelligence-in-microsoft-power-bi/&lt;/A&gt;</description>
    <pubDate>Sun, 12 Apr 2020 11:42:43 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2020-04-12T11:42:43Z</dc:date>
    <item>
      <title>DAX MTD &amp; Prior Year</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-MTD-amp-Prior-Year/m-p/1016898#M13091</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to calcuate the count for the current year &amp;amp; month; 2020 Jan to April (current month) and also show the same period Jan to April but for last year 2019. I have created a date table and marked it as a date table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Date =&lt;BR /&gt;ADDCOLUMNS (&lt;BR /&gt;CALENDAR (DATE(2000,1,1), DATE(2025,12,31)),&lt;BR /&gt;"DateAsInteger", FORMAT ( [Date], "YYYYMMDD" ),&lt;BR /&gt;"Year", YEAR ( [Date] ),&lt;BR /&gt;"Monthnumber", FORMAT ( [Date], "MM" ),&lt;BR /&gt;"YearMonthnumber", FORMAT ( [Date], "YYYY/MM" ),&lt;BR /&gt;"YearMonthShort", FORMAT ( [Date], "YYYY/mmm" ),&lt;BR /&gt;"MonthNameShort", FORMAT ( [Date], "mmm" ),&lt;BR /&gt;"MonthNameLong", FORMAT ( [Date], "mmmm" ),&lt;BR /&gt;"DayOfWeekNumber", WEEKDAY ( [Date] ),&lt;BR /&gt;"DayOfWeek", FORMAT ( [Date], "dddd" ),&lt;BR /&gt;"DayOfWeekShort", FORMAT ( [Date], "ddd" ),&lt;BR /&gt;"Quarter", "Q" &amp;amp; FORMAT ( [Date], "Q" ),&lt;BR /&gt;"YearQuarter", FORMAT ( [Date], "YYYY" ) &amp;amp; "/Q" &amp;amp; FORMAT ( [Date], "Q" )&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;which has a 1 to many relationship to my data table 'New Business' [Variation Issue Date]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Current Year DAX :&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Count YTD = CALCULATE(COUNT('New Business'[Count]), DATESYTD('New Business'[Variation Issue Date]))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;returns the correct count of 8206.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Prior Year DAX:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;target = 9952&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Count PYTD = CALCULATE([Count YTD], SAMEPERIODLASTYEAR('Date'[Date])) &lt;EM&gt;returns same count as current year&lt;/EM&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Count PYTD = CALCULATE([Count YTD], SAMEPERIODLASTYEAR('New Business'[Variation Issue Date])) &lt;EM&gt;returns error&amp;nbsp;Function 'SAMEPERIODLASTYEAR' expects a contiguous selection when the date column is not unique, has gaps or it contains time portion&lt;/EM&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Count PYTD = CALCULATE(TOTALMTD(COUNT('New Business'[Count]),'Date'[Date]), SAMEPERIODLASTYEAR('Date'[Date])) &lt;EM&gt;returns blank&lt;/EM&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Count PYTD = CALCULATE(TOTALMTD(COUNT('New Business'[Count]),'New Business'[Variation Issue Date]), SAMEPERIODLASTYEAR('Date'[Date])) &lt;EM&gt;returns 2813&lt;BR /&gt;&lt;/EM&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Count PYTD = CALCULATE([Count YTD], DATEADD('Date'[Date],-1, year)) &lt;EM&gt;returns 8206&lt;/EM&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Count PYTD = CALCULATE(count('New Business'[Count]), DATEADD('Date'[Date],-1, year)) &lt;EM&gt;returns 386804&lt;/EM&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I have tried a few different ways to do it and none of them work, so any help would be appreicated.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thanks&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 09 Apr 2020 06:52:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-MTD-amp-Prior-Year/m-p/1016898#M13091</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-04-09T06:52:50Z</dc:date>
    </item>
    <item>
      <title>Re: DAX MTD &amp; Prior Year</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-MTD-amp-Prior-Year/m-p/1017448#M13102</link>
      <description>&lt;P&gt;Can you post sample data as text so that this can be recreated?&amp;nbsp;Please see this post regarding How to Get Your Question Answered Quickly: &lt;A href="https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490" target="_blank"&gt;https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Apr 2020 11:13:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-MTD-amp-Prior-Year/m-p/1017448#M13102</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2020-04-09T11:13:06Z</dc:date>
    </item>
    <item>
      <title>Re: DAX MTD &amp; Prior Year</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-MTD-amp-Prior-Year/m-p/1017490#M13104</link>
      <description>&lt;P&gt;Did you try&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CALCULATE([Count YTD], DATEADD(&lt;SPAN&gt;'New Business'[Variation Issue Date]&lt;/SPAN&gt;,-1, year))&lt;/P&gt;</description>
      <pubDate>Thu, 09 Apr 2020 11:51:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-MTD-amp-Prior-Year/m-p/1017490#M13104</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-04-09T11:51:10Z</dc:date>
    </item>
    <item>
      <title>Re: DAX MTD &amp; Prior Year</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-MTD-amp-Prior-Year/m-p/1021228#M13213</link>
      <description>&lt;A href="https://www.sqlbi.com/tv/time-intelligence-in-microsoft-power-bi/" target="_blank"&gt;https://www.sqlbi.com/tv/time-intelligence-in-microsoft-power-bi/&lt;/A&gt;</description>
      <pubDate>Sun, 12 Apr 2020 11:42:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-MTD-amp-Prior-Year/m-p/1021228#M13213</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-04-12T11:42:43Z</dc:date>
    </item>
    <item>
      <title>Re: DAX MTD &amp; Prior Year</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-MTD-amp-Prior-Year/m-p/1021598#M13239</link>
      <description>&lt;P&gt;The variation issue date seems to have data issues, DATEADD&amp;nbsp;&lt;EM&gt;expects a contiguous selection when the date column is not unique, has gaps or it contains time portion.&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Apr 2020 00:15:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-MTD-amp-Prior-Year/m-p/1021598#M13239</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-04-13T00:15:50Z</dc:date>
    </item>
    <item>
      <title>Re: DAX MTD &amp; Prior Year</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-MTD-amp-Prior-Year/m-p/1021608#M13242</link>
      <description>Indeed, time-intel functions require that a set of dates contain all dates between the max and min date of the set.&lt;BR /&gt;&lt;BR /&gt;Best&lt;BR /&gt;D</description>
      <pubDate>Mon, 13 Apr 2020 00:35:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-MTD-amp-Prior-Year/m-p/1021608#M13242</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-04-13T00:35:35Z</dc:date>
    </item>
    <item>
      <title>Re: DAX MTD &amp; Prior Year</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-MTD-amp-Prior-Year/m-p/1021609#M13243</link>
      <description>&lt;P&gt;What does the time intel function base the expected min &amp;amp; max on, My date table has generic start and end times I haven't used a column as there are more than one table connected to it. The data is a dimension table so the dates aren't consective. Can I use a FORMAT function within the DAX to get around this problem?&lt;/P&gt;</description>
      <pubDate>Mon, 13 Apr 2020 00:49:02 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-MTD-amp-Prior-Year/m-p/1021609#M13243</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-04-13T00:49:02Z</dc:date>
    </item>
    <item>
      <title>Re: DAX MTD &amp; Prior Year</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-MTD-amp-Prior-Year/m-p/1021617#M13244</link>
      <description>&lt;A href="https://www.sqlbi.com/tv/time-intelligence-in-microsoft-power-bi/" target="_blank"&gt;https://www.sqlbi.com/tv/time-intelligence-in-microsoft-power-bi/&lt;/A&gt;</description>
      <pubDate>Mon, 13 Apr 2020 00:59:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-MTD-amp-Prior-Year/m-p/1021617#M13244</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-04-13T00:59:57Z</dc:date>
    </item>
    <item>
      <title>Re: DAX MTD &amp; Prior Year</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-MTD-amp-Prior-Year/m-p/1021644#M13245</link>
      <description>&lt;P&gt;Hi Greg,&lt;/P&gt;&lt;P&gt;Thanks for the reply. I tried inserting a table but it doesn't allow for enough rows so here's some data. All 2020 and the first three months of 2019.&amp;nbsp; Just a count of a column and the data field pretty simple.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://drive.google.com/open?id=1bIyarSPC-hoU2Wa1OTOrP1xJKWZjyukE&amp;nbsp;" target="_blank"&gt;https://drive.google.com/open?id=1bIyarSPC-hoU2Wa1OTOrP1xJKWZjyukE&amp;nbsp;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;hope it works&lt;/P&gt;</description>
      <pubDate>Mon, 13 Apr 2020 01:30:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-MTD-amp-Prior-Year/m-p/1021644#M13245</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-04-13T01:30:34Z</dc:date>
    </item>
    <item>
      <title>Re: DAX MTD &amp; Prior Year</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-MTD-amp-Prior-Year/m-p/1028816#M13457</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;I found the problem the PYTD is returning 35976 in the top table when it should be 7686 as per bottom table. So it is summing the entire year instead of the same period in the YTD measure. This is becuase the fact table date variation issue date produces the error,&amp;nbsp;&lt;EM&gt;Function 'SAMEPERIODLASTYEAR' expects a contiguous selection when the date column is not unique, has gaps or it contains time portion.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Count YTD = TOTALYTD('_Measures NB'[Count NB], 'New Business'[Variation Issue Date])&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Count PYTD = IF(ISBLANK([Count YTD]),BLANK(), CALCULATE([Count NB],SAMEPERIODLASTYEAR('Date'[Date])))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So becuase i have to use the the date table date I need a way to calculate for last year but current month eg. year -1, current months.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 16 Apr 2020 02:54:44 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-MTD-amp-Prior-Year/m-p/1028816#M13457</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-04-16T02:54:44Z</dc:date>
    </item>
    <item>
      <title>Re: DAX MTD &amp; Prior Year</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-MTD-amp-Prior-Year/m-p/1029067#M13464</link>
      <description>&lt;P&gt;I have wrriten the following DAX but it returns nothing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Count PYTD = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;VAR startdate = DATE(YEAR(NOW())-1,MONTH(1), DAY(1))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;VAR enddate = DATE(YEAR(NOW())-1,MONTH(NOW()), DAY(NOW()))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Return&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;CALCULATE(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;[Count NB],&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; FILTER('Date','Date'[Date] &amp;gt;=startdate &amp;amp;&amp;amp; 'Date'[Date] &amp;lt;= enddate)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ) &lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 16 Apr 2020 05:39:48 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-MTD-amp-Prior-Year/m-p/1029067#M13464</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-04-16T05:39:48Z</dc:date>
    </item>
  </channel>
</rss>

