<?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: Restrict YTD with Max order date and keeps filter of Calender table in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Restrict-YTD-with-Max-order-date-and-keeps-filter-of-Calender/m-p/3064872#M106076</link>
    <description>&lt;P&gt;It sounds like you want the current results but blanks after your latest sales order date? This may be what you want:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Total YTD (current) = 
VAR _currentDate = MAX( 'Calender Table'[Date] )
VAR _maxOrderDate = CALCULATE( MAX( Data[Order Date] ), REMOVEFILTERS( Data ) )
RETURN
IF(  
    _currentDate &amp;lt;= _maxOrderDate,
    TOTALYTD(
        [Total sales],
        'Calender Table'[Date]
    )+0
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is the output with 'Show items with no data' turned on so you can see the measure dropping off after 27 Jan 2018:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Note that if you want the measure to be blank instead of zero before the first order, then remove the "+0" after the TOTALYTD function.&lt;/P&gt;</description>
    <pubDate>Mon, 06 Feb 2023 22:50:11 GMT</pubDate>
    <dc:creator>MarkLaf</dc:creator>
    <dc:date>2023-02-06T22:50:11Z</dc:date>
    <item>
      <title>Restrict YTD with Max order date and keeps filter of Calender table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Restrict-YTD-with-Max-order-date-and-keeps-filter-of-Calender/m-p/3051084#M105092</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;how can I bring previous row value to the next row. Like in below table, i do not have value in 13th Jan, so it should show 12th Jan Value.&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;img /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have using the below dax because I have to restric ytd upto the max order date.&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Total YTD (current) = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;TOTALYTD&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;[Total sales]&lt;/SPAN&gt;&lt;SPAN&gt;,&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; &lt;/SPAN&gt;&lt;SPAN&gt;'Calender Table'&lt;/SPAN&gt;&lt;SPAN&gt;[Date]&lt;/SPAN&gt;&lt;SPAN&gt;,&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; &lt;/SPAN&gt;&lt;SPAN&gt;'Calender Table'&lt;/SPAN&gt;&lt;SPAN&gt;[Date]&lt;/SPAN&gt;&lt;SPAN&gt; &amp;lt;= &lt;/SPAN&gt;&lt;SPAN&gt;MAX&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;Data&lt;/SPAN&gt;&lt;SPAN&gt;[Order Date]&lt;/SPAN&gt;&lt;SPAN&gt;)&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; )&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thanks.&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 30 Jan 2023 18:56:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Restrict-YTD-with-Max-order-date-and-keeps-filter-of-Calender/m-p/3051084#M105092</guid>
      <dc:creator>Rahul_SC</dc:creator>
      <dc:date>2023-01-30T18:56:29Z</dc:date>
    </item>
    <item>
      <title>Re: Restrict YTD with Max order date and keeps filter of Calender table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Restrict-YTD-with-Max-order-date-and-keeps-filter-of-Calender/m-p/3051287#M105103</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="379438" data-lia-user-login="Rahul_SC" class="lia-mention lia-mention-user"&gt;Rahul_SC&lt;/a&gt;&amp;nbsp;, Try to replace the blank in the &lt;SPAN&gt;[Total sales]&amp;nbsp;&lt;/SPAN&gt;measure.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/dax/coalesce-function-dax" target="_blank"&gt;https://learn.microsoft.com/en-us/dax/coalesce-function-dax&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Jan 2023 22:38:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Restrict-YTD-with-Max-order-date-and-keeps-filter-of-Calender/m-p/3051287#M105103</guid>
      <dc:creator>SivaMani</dc:creator>
      <dc:date>2023-01-30T22:38:29Z</dc:date>
    </item>
    <item>
      <title>Re: Restrict YTD with Max order date and keeps filter of Calender table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Restrict-YTD-with-Max-order-date-and-keeps-filter-of-Calender/m-p/3051849#M105145</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="23457" data-lia-user-login="SivaMani" class="lia-mention lia-mention-user"&gt;SivaMani&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for responding.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I replaced blank with 0 in total sales measure. but It is not giving what I want. Instead of 0, it should show previous value which is available like YTD.&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;And it is also showing the data for full year. If you see the below image, I do not have sales data after 27-Jan, there also it is showing 0 now. it should be blank as sale is not done after this date.&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;One solution worked if I restrict my calender table using this. But I do not want to restrict calender table because it is used in defferent visuals where I need all the dates for full year.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;CALENDAR(MIN(Data[Order Date]),MAX(Data[Order Date]))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;thanks&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 31 Jan 2023 06:48:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Restrict-YTD-with-Max-order-date-and-keeps-filter-of-Calender/m-p/3051849#M105145</guid>
      <dc:creator>Rahul_SC</dc:creator>
      <dc:date>2023-01-31T06:48:38Z</dc:date>
    </item>
    <item>
      <title>Re: Restrict YTD with Max order date and keeps filter of Calender table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Restrict-YTD-with-Max-order-date-and-keeps-filter-of-Calender/m-p/3051905#M105151</link>
      <description>&lt;DIV&gt;&lt;SPAN&gt;Total YTD (current) =&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;TOTALYTD&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;[Total sales]&lt;/SPAN&gt;&lt;SPAN&gt;,&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;&lt;/SPAN&gt;&lt;SPAN&gt;'Calender Table'&lt;/SPAN&gt;&lt;SPAN&gt;[Date]&lt;/SPAN&gt;&lt;SPAN&gt;,&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;&lt;/SPAN&gt;&lt;SPAN&gt;'Calender Table'&lt;/SPAN&gt;&lt;SPAN&gt;[Date]&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&amp;lt;=&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;MAX&lt;/SPAN&gt;&lt;SPAN&gt;('Calender Table'[Date]&lt;/SPAN&gt;&lt;SPAN&gt;)&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; )&lt;/SPAN&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 31 Jan 2023 07:13:55 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Restrict-YTD-with-Max-order-date-and-keeps-filter-of-Calender/m-p/3051905#M105151</guid>
      <dc:creator>wdx223_Daniel</dc:creator>
      <dc:date>2023-01-31T07:13:55Z</dc:date>
    </item>
    <item>
      <title>Re: Restrict YTD with Max order date and keeps filter of Calender table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Restrict-YTD-with-Max-order-date-and-keeps-filter-of-Calender/m-p/3051930#M105155</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="264353" data-lia-user-login="wdx223_Daniel" class="lia-mention lia-mention-user"&gt;wdx223_Daniel&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am already using this dax (see in my post). It is showing blank where order is not placed on any date.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am instead of blank it should show previous YTD value.&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jan 2023 07:21:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Restrict-YTD-with-Max-order-date-and-keeps-filter-of-Calender/m-p/3051930#M105155</guid>
      <dc:creator>Rahul_SC</dc:creator>
      <dc:date>2023-01-31T07:21:29Z</dc:date>
    </item>
    <item>
      <title>Re: Restrict YTD with Max order date and keeps filter of Calender table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Restrict-YTD-with-Max-order-date-and-keeps-filter-of-Calender/m-p/3051955#M105159</link>
      <description>&lt;P&gt;in the Function of MAX, use the date column from Calendar Table, instead of Data Table&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jan 2023 07:35:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Restrict-YTD-with-Max-order-date-and-keeps-filter-of-Calender/m-p/3051955#M105159</guid>
      <dc:creator>wdx223_Daniel</dc:creator>
      <dc:date>2023-01-31T07:35:29Z</dc:date>
    </item>
    <item>
      <title>Re: Restrict YTD with Max order date and keeps filter of Calender table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Restrict-YTD-with-Max-order-date-and-keeps-filter-of-Calender/m-p/3051970#M105161</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Did this.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Total YTD (current) = &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; &lt;/SPAN&gt;&lt;SPAN&gt;TOTALYTD&lt;/SPAN&gt;&lt;SPAN&gt;([Total sales],&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; 'Calender Table'[Date],&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; 'Calender Table'[Date] &amp;lt;= &lt;/SPAN&gt;&lt;SPAN&gt;MAX&lt;/SPAN&gt;&lt;SPAN&gt;('Calender Table'[Date])&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; )&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;It is repeating the value on the day where order did not happen. Now, it show blank after 27-Jan as this is the last order date.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;img /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 31 Jan 2023 07:44:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Restrict-YTD-with-Max-order-date-and-keeps-filter-of-Calender/m-p/3051970#M105161</guid>
      <dc:creator>Rahul_SC</dc:creator>
      <dc:date>2023-01-31T07:44:53Z</dc:date>
    </item>
    <item>
      <title>Re: Restrict YTD with Max order date and keeps filter of Calender table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Restrict-YTD-with-Max-order-date-and-keeps-filter-of-Calender/m-p/3064872#M106076</link>
      <description>&lt;P&gt;It sounds like you want the current results but blanks after your latest sales order date? This may be what you want:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Total YTD (current) = 
VAR _currentDate = MAX( 'Calender Table'[Date] )
VAR _maxOrderDate = CALCULATE( MAX( Data[Order Date] ), REMOVEFILTERS( Data ) )
RETURN
IF(  
    _currentDate &amp;lt;= _maxOrderDate,
    TOTALYTD(
        [Total sales],
        'Calender Table'[Date]
    )+0
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is the output with 'Show items with no data' turned on so you can see the measure dropping off after 27 Jan 2018:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Note that if you want the measure to be blank instead of zero before the first order, then remove the "+0" after the TOTALYTD function.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Feb 2023 22:50:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Restrict-YTD-with-Max-order-date-and-keeps-filter-of-Calender/m-p/3064872#M106076</guid>
      <dc:creator>MarkLaf</dc:creator>
      <dc:date>2023-02-06T22:50:11Z</dc:date>
    </item>
  </channel>
</rss>

