<?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: Search for last date with certain condition in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Search-for-last-date-with-certain-condition/m-p/2252701#M54316</link>
    <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;This should do what you are describing:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Irrigation Maxdate = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;selection&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;SELECTEDVALUE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Irrigation T'[Irrigation]&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;sector&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;MAX&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;Irrigation[Sector]&lt;/SPAN&gt;&lt;SPAN&gt;) &lt;/SPAN&gt;&lt;SPAN&gt;return&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;MAXX&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;filter&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;Irrigation&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;Irrigation[Irrigatio]&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;2&lt;/SPAN&gt;&lt;SPAN&gt;*&lt;/SPAN&gt;&lt;SPAN&gt;selection&lt;/SPAN&gt;&lt;SPAN&gt;&amp;amp;&amp;amp;&lt;/SPAN&gt;&lt;SPAN&gt;Irrigation[Sector]&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;sector&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;SPAN&gt;Irrigation[date]&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;img /&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp;I hope this helps and if it does consider accepting this as a solution and giving the post a thumbs up!&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Wed, 22 Dec 2021 22:24:37 GMT</pubDate>
    <dc:creator>ValtteriN</dc:creator>
    <dc:date>2021-12-22T22:24:37Z</dc:date>
    <item>
      <title>Search for last date with certain condition</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Search-for-last-date-with-certain-condition/m-p/2252609#M54301</link>
      <description>&lt;P&gt;Hello, I'm Agustin lopez, Horticulture from Chile working with avocado. I'm working with some irrigation data set anda&amp;nbsp; I need a hand with a DAX.&lt;BR /&gt;&lt;BR /&gt;I have 2 tables.&lt;BR /&gt;1- The theorical data table that is supouse what has to happend. (Name: Base de dato Agricola)&lt;BR /&gt;2- The data table with the data that really happend. (Name: Informacion Agricola)&lt;BR /&gt;&lt;BR /&gt;I have the following data set&lt;BR /&gt;&lt;BR /&gt;Table 1 (theorical irrigation)&lt;BR /&gt;Sector&amp;nbsp; &amp;nbsp; &amp;nbsp;Time of irrigation(min)&lt;BR /&gt;&amp;nbsp; &amp;nbsp;5&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;80&lt;BR /&gt;&amp;nbsp; &amp;nbsp;6&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 100&lt;BR /&gt;&lt;BR /&gt;Table 2 (Real Irrigation)&lt;BR /&gt;Sector&amp;nbsp; &amp;nbsp; &amp;nbsp; Date&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Time of irrigation&lt;BR /&gt;&amp;nbsp;5&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;20-11-2021&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;80&lt;BR /&gt;&amp;nbsp;5&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 22-11-2021&amp;nbsp; &amp;nbsp; &amp;nbsp;160&lt;BR /&gt;&amp;nbsp;5&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;01-12-2021&amp;nbsp; &amp;nbsp; &amp;nbsp;80&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;In the dax, I need to see when was the last day (max date) of an irrigation that has a 2x time of irrigation from the Theorical data (Table 1). i.e. the dax should give me back the date of 22-11-2021&amp;nbsp; of the data set as example. I use as a key the Sector.&lt;BR /&gt;&lt;BR /&gt;Thanks!&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Dec 2021 19:42:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Search-for-last-date-with-certain-condition/m-p/2252609#M54301</guid>
      <dc:creator>Alopez11</dc:creator>
      <dc:date>2021-12-22T19:42:54Z</dc:date>
    </item>
    <item>
      <title>Re: Search for last date with certain condition</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Search-for-last-date-with-certain-condition/m-p/2252701#M54316</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;This should do what you are describing:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Irrigation Maxdate = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;selection&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;SELECTEDVALUE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Irrigation T'[Irrigation]&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;sector&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;MAX&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;Irrigation[Sector]&lt;/SPAN&gt;&lt;SPAN&gt;) &lt;/SPAN&gt;&lt;SPAN&gt;return&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;MAXX&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;filter&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;Irrigation&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;Irrigation[Irrigatio]&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;2&lt;/SPAN&gt;&lt;SPAN&gt;*&lt;/SPAN&gt;&lt;SPAN&gt;selection&lt;/SPAN&gt;&lt;SPAN&gt;&amp;amp;&amp;amp;&lt;/SPAN&gt;&lt;SPAN&gt;Irrigation[Sector]&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;sector&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;SPAN&gt;Irrigation[date]&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;img /&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp;I hope this helps and if it does consider accepting this as a solution and giving the post a thumbs up!&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 22 Dec 2021 22:24:37 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Search-for-last-date-with-certain-condition/m-p/2252701#M54316</guid>
      <dc:creator>ValtteriN</dc:creator>
      <dc:date>2021-12-22T22:24:37Z</dc:date>
    </item>
    <item>
      <title>Re: Search for last date with certain condition</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Search-for-last-date-with-certain-condition/m-p/2252782#M54325</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="321221" data-lia-user-login="Alopez11" class="lia-mention lia-mention-user"&gt;Alopez11&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Try this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="php"&gt;max date of an irrigation =
VAR _A =
    MAX( 'theorical irrigation'[Time of irrigation] )
VAR _B =
    FILTER(
        ADDCOLUMNS(
            'Real Irrigation',
            "TI", 'Real Irrigation'[Time of irrigation] / _A
        ),
        [TI] &amp;gt;= 2
    )
RETURN
    MAXX( _B, [Date] )&lt;/LI-CODE&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;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I used this table as a Real Irrigation (Add some data for Sector 6):&lt;/P&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&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;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and the Output:&lt;/P&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&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;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If this post&amp;nbsp;&lt;STRONG&gt;&lt;SPAN&gt;helps&lt;/SPAN&gt;&lt;/STRONG&gt;, please consider&amp;nbsp;&lt;SPAN&gt;&lt;STRONG&gt;&lt;SPAN&gt;accepting&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;it as the solution&lt;/SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/EM&gt;to help the other members find it more quickly.&lt;BR /&gt;&lt;STRONG&gt;&lt;SPAN&gt;Appreciate your Kudos!!&lt;BR /&gt;&lt;STRONG&gt;LinkedIn:&amp;nbsp;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&lt;A href="https://www.linkedin.com/in/vahid-dm/" target="_blank" rel="noopener"&gt;www.linkedin.com/in/vahid-dm/&lt;/A&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Dec 2021 23:38:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Search-for-last-date-with-certain-condition/m-p/2252782#M54325</guid>
      <dc:creator>VahidDM</dc:creator>
      <dc:date>2021-12-22T23:38:59Z</dc:date>
    </item>
    <item>
      <title>Re: Search for last date with certain condition</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Search-for-last-date-with-certain-condition/m-p/2253756#M54358</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="315278" data-lia-user-login="VahidDM" class="lia-mention lia-mention-user"&gt;VahidDM&lt;/a&gt;&amp;nbsp;thanks for your solution, It's work really well tell me when you come to chile to give u some avocados hahaha&lt;BR /&gt;&lt;BR /&gt;Can i ask you one last question.&lt;BR /&gt;If know I want to count how many of those events of 2x irrigation happend how can I do it?&lt;BR /&gt;&lt;BR /&gt;Same data set.&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 23 Dec 2021 13:11:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Search-for-last-date-with-certain-condition/m-p/2253756#M54358</guid>
      <dc:creator>Alopez11</dc:creator>
      <dc:date>2021-12-23T13:11:56Z</dc:date>
    </item>
    <item>
      <title>Re: Search for last date with certain condition</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Search-for-last-date-with-certain-condition/m-p/2254449#M54394</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="321221" data-lia-user-login="Alopez11" class="lia-mention lia-mention-user"&gt;Alopez11&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Chile is in my travel list now &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Try this to c&lt;SPAN&gt;ount how many of those events of 2x irrigation happend&amp;nbsp;:&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="php"&gt;max date of an irrigation =
VAR _A =
    MAX( 'theorical irrigation'[Time of irrigation] )
VAR _B =
    FILTER(
        ADDCOLUMNS(
            'Real Irrigation',
            "TI", 'Real Irrigation'[Time of irrigation] / _A
        ),
        [TI] &amp;gt;= 2
    )
RETURN
    COUNTROWS( _B )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If this post&amp;nbsp;&lt;STRONG&gt;&lt;SPAN&gt;helps&lt;/SPAN&gt;&lt;/STRONG&gt;, please consider&amp;nbsp;&lt;FONT color="#339966"&gt;&lt;U&gt;&lt;STRONG&gt;accepting&lt;/STRONG&gt;&lt;/U&gt;&lt;EM&gt;&lt;STRONG&gt;&lt;SPAN&gt;&lt;U&gt;&amp;nbsp;it as the solution&lt;/U&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/FONT&gt;to help the other members find it more quickly.&lt;BR /&gt;&lt;STRONG&gt;&lt;SPAN&gt;Appreciate your Kudos!!&lt;BR /&gt;&lt;STRONG&gt;LinkedIn:&amp;nbsp;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&lt;A href="https://www.linkedin.com/in/vahid-dm/" target="_blank"&gt;www.linkedin.com/in/vahid-dm/&lt;/A&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Dec 2021 23:50:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Search-for-last-date-with-certain-condition/m-p/2254449#M54394</guid>
      <dc:creator>VahidDM</dc:creator>
      <dc:date>2021-12-23T23:50:50Z</dc:date>
    </item>
  </channel>
</rss>

