<?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 Minus years from date in filter in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Minus-years-from-date-in-filter/m-p/4129527#M164001</link>
    <description>&lt;P&gt;All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using the folowing measure, which works well.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Measure&lt;/SPAN&gt; &lt;SPAN&gt;&amp;nbsp;=&lt;/SPAN&gt; &lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;SUM&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Dead Stock &lt;/SPAN&gt;&lt;SPAN&gt;[Stk Value]&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;SPAN&gt;'Dead Stock'&lt;/SPAN&gt;&lt;SPAN&gt;[Last Purchased Year]&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;'Dead Stock '&lt;/SPAN&gt;&lt;SPAN&gt;[Last Purchased Year]&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;However, I wish to have this filter only show items that are 5 years old or more i.e. 2019 or below. I have tried various things but unable to get it to work with years. If I type days like below in I get it to work, how can I alter it to allow years?&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Measure&lt;/SPAN&gt; &lt;SPAN&gt;&amp;nbsp;=&lt;/SPAN&gt; &lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;SUM&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Dead Stock &lt;/SPAN&gt;&lt;SPAN&gt;[Stk Value]&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;SPAN&gt;'Dead Stock'&lt;/SPAN&gt;&lt;SPAN&gt;[Last Purchased Year]&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;'Dead Stock '&lt;/SPAN&gt;&lt;SPAN&gt;[Last Purchased Year]&lt;/SPAN&gt;&lt;SPAN&gt;)-1825)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Mon, 02 Sep 2024 12:47:28 GMT</pubDate>
    <dc:creator>coatsy35</dc:creator>
    <dc:date>2024-09-02T12:47:28Z</dc:date>
    <item>
      <title>Minus years from date in filter</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Minus-years-from-date-in-filter/m-p/4129527#M164001</link>
      <description>&lt;P&gt;All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using the folowing measure, which works well.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Measure&lt;/SPAN&gt; &lt;SPAN&gt;&amp;nbsp;=&lt;/SPAN&gt; &lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;SUM&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Dead Stock &lt;/SPAN&gt;&lt;SPAN&gt;[Stk Value]&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;SPAN&gt;'Dead Stock'&lt;/SPAN&gt;&lt;SPAN&gt;[Last Purchased Year]&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;'Dead Stock '&lt;/SPAN&gt;&lt;SPAN&gt;[Last Purchased Year]&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;However, I wish to have this filter only show items that are 5 years old or more i.e. 2019 or below. I have tried various things but unable to get it to work with years. If I type days like below in I get it to work, how can I alter it to allow years?&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Measure&lt;/SPAN&gt; &lt;SPAN&gt;&amp;nbsp;=&lt;/SPAN&gt; &lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;SUM&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Dead Stock &lt;/SPAN&gt;&lt;SPAN&gt;[Stk Value]&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;SPAN&gt;'Dead Stock'&lt;/SPAN&gt;&lt;SPAN&gt;[Last Purchased Year]&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;'Dead Stock '&lt;/SPAN&gt;&lt;SPAN&gt;[Last Purchased Year]&lt;/SPAN&gt;&lt;SPAN&gt;)-1825)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 02 Sep 2024 12:47:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Minus-years-from-date-in-filter/m-p/4129527#M164001</guid>
      <dc:creator>coatsy35</dc:creator>
      <dc:date>2024-09-02T12:47:28Z</dc:date>
    </item>
    <item>
      <title>Re: Minus years from date in filter</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Minus-years-from-date-in-filter/m-p/4129536#M164002</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="303502" data-lia-user-login="coatsy35" class="lia-mention lia-mention-user"&gt;coatsy35&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I suppose that&amp;nbsp;&lt;SPAN&gt;[Last Purchased Year] actually is a full date column and not a year column. So if it's full date you can just write year('Dead Stock'[Last Purchased Year])&amp;lt;=year('Dead Stock'[Last Purchased Year])-4&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Sep 2024 12:57:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Minus-years-from-date-in-filter/m-p/4129536#M164002</guid>
      <dc:creator>Gabry</dc:creator>
      <dc:date>2024-09-02T12:57:04Z</dc:date>
    </item>
    <item>
      <title>Re: Minus years from date in filter</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Minus-years-from-date-in-filter/m-p/4129539#M164003</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="470368" data-lia-user-login="Gabry" class="lia-mention lia-mention-user"&gt;Gabry&lt;/a&gt;&amp;nbsp;its actaully a column of year and not date&lt;/P&gt;</description>
      <pubDate>Mon, 02 Sep 2024 12:59:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Minus-years-from-date-in-filter/m-p/4129539#M164003</guid>
      <dc:creator>coatsy35</dc:creator>
      <dc:date>2024-09-02T12:59:17Z</dc:date>
    </item>
    <item>
      <title>Re: Minus years from date in filter</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Minus-years-from-date-in-filter/m-p/4129553#M164006</link>
      <description>&lt;P&gt;So how can it works with -1825? Is it a number? Please provide sample data&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Sep 2024 13:09:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Minus-years-from-date-in-filter/m-p/4129553#M164006</guid>
      <dc:creator>Gabry</dc:creator>
      <dc:date>2024-09-02T13:09:36Z</dc:date>
    </item>
    <item>
      <title>Re: Minus years from date in filter</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Minus-years-from-date-in-filter/m-p/4130196#M164046</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="303502" data-lia-user-login="coatsy35" class="lia-mention lia-mention-user"&gt;coatsy35&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Based on your description, I created this data.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;You think that Last Purchased Year is just YEAR probably because it is formatted as yyyy, when in fact the essence is still the full date column.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;So you can try what&amp;nbsp;Gabry&amp;nbsp; said and it will give you the correct results as well.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Alternatively, you could try creating a separate calculated column for year.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Year =
YEAR('Table'[Last Purchased Year])&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then, use the calculated column to get the desired result.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure 3 = 
CALCULATE(SUM('Table'[Stk Value]),'Table'[Year] &amp;lt;= MAX('Table'[Year]) - 5)&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If your Current Period does not refer to this, please clarify in a follow-up reply.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Clara Gong&lt;/P&gt;
&lt;P&gt;If there is any post&amp;nbsp;&lt;STRONG&gt;&lt;I&gt;helps&lt;/I&gt;&lt;/STRONG&gt;, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;I&gt;Accept it as the solution&lt;/I&gt;&lt;/STRONG&gt;&amp;nbsp;&amp;nbsp;to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Sep 2024 02:29:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Minus-years-from-date-in-filter/m-p/4130196#M164046</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-09-03T02:29:22Z</dc:date>
    </item>
    <item>
      <title>Re: Minus years from date in filter</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Minus-years-from-date-in-filter/m-p/4130843#M164071</link>
      <description>&lt;P&gt;Yuo are quite right. I wasn't looking correctly at the format. Sorted now with&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="470368" data-lia-user-login="Gabry" class="lia-mention lia-mention-user"&gt;Gabry&lt;/a&gt;&amp;nbsp;answer. Thank you&lt;/P&gt;</description>
      <pubDate>Tue, 03 Sep 2024 08:46:41 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Minus-years-from-date-in-filter/m-p/4130843#M164071</guid>
      <dc:creator>coatsy35</dc:creator>
      <dc:date>2024-09-03T08:46:41Z</dc:date>
    </item>
  </channel>
</rss>

