<?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 Next date limited by another 'filter table' with dates in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Next-date-limited-by-another-filter-table-with-dates/m-p/805784#M4992</link>
    <description>&lt;P&gt;&lt;FONT size="2"&gt;&lt;STRONG&gt;Table1: ID, DateA&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;PRE&gt;1, 2019-01-01
2, 2019-01-02
3, 2019-01-03
4, 2019-01-04
5, 2019-01-05
6, 2019-01-06&lt;/PRE&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT size="2"&gt;&lt;STRONG&gt;Table 2 (non working days): DateB&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;PRE&gt;2019-01-02
2019-01-05
2019-01-06&lt;/PRE&gt;&lt;P&gt;&lt;FONT size="2"&gt;&lt;STRONG&gt;Table 1 (calculated column added):&amp;nbsp;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;&lt;STRONG&gt;ID, DateA, DateC&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;PRE&gt;&lt;FONT color="#000000"&gt;1, 2019-01-01,&amp;nbsp;2019-01-03
2, 2019-01-02,&amp;nbsp;2019-01-03
3, 2019-01-03,&amp;nbsp;2019-01-04
4, 2019-01-04,&amp;nbsp;2019-01-07
5, 2019-01-05,&amp;nbsp;2019-01-07
6, 2019-01-06,&amp;nbsp;2019-01-07&lt;/FONT&gt;&lt;/PRE&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;I want to add a calculated column to Table 1.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;The logical steps are:&lt;/FONT&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;FONT color="#000000"&gt;Date after date 2019-01-01 in Table 1 is&amp;nbsp;2019-01-02.&lt;/FONT&gt;&lt;/LI&gt;&lt;LI&gt;&lt;FONT color="#000000"&gt;Check if date&amp;nbsp;2019-01-02 is in Table 2.&lt;/FONT&gt;&lt;/LI&gt;&lt;LI&gt;&lt;FONT color="#000000"&gt;If date&amp;nbsp;2019-01-02 is in Table 2 then check if 2019-01-03 is in Table 2.&lt;/FONT&gt;&lt;/LI&gt;&lt;LI&gt;&lt;FONT color="#000000"&gt;Repeat until there is a 'date after' result which is not in Table 2.&lt;/FONT&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;Note: &lt;EM&gt;it is possible that the next date &lt;U&gt;does not exist&lt;/U&gt; in Table 1, so I'm looking for the next date &lt;U&gt;in general&lt;/U&gt;&amp;nbsp;which &lt;U&gt;does not&lt;/U&gt; exist in Table 2. That's why 2019-01-07 is a valid result.&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;EM&gt;I found a solution in Power Query:&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;&lt;EM&gt;&lt;A href="https://community.powerbi.com/t5/Power-Query/Add-column-with-next-date-filtered-by-another-dates-table/m-p/806700/highlight/false#M27054" target="_blank"&gt;https://community.powerbi.com/t5/Power-Query/Add-column-with-next-date-filtered-by-another-dates-table/m-p/806700/highlight/false#M27054&lt;/A&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 02 Oct 2019 12:49:21 GMT</pubDate>
    <dc:creator>richard-powerbi</dc:creator>
    <dc:date>2019-10-02T12:49:21Z</dc:date>
    <item>
      <title>Next date limited by another 'filter table' with dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Next-date-limited-by-another-filter-table-with-dates/m-p/805784#M4992</link>
      <description>&lt;P&gt;&lt;FONT size="2"&gt;&lt;STRONG&gt;Table1: ID, DateA&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;PRE&gt;1, 2019-01-01
2, 2019-01-02
3, 2019-01-03
4, 2019-01-04
5, 2019-01-05
6, 2019-01-06&lt;/PRE&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT size="2"&gt;&lt;STRONG&gt;Table 2 (non working days): DateB&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;PRE&gt;2019-01-02
2019-01-05
2019-01-06&lt;/PRE&gt;&lt;P&gt;&lt;FONT size="2"&gt;&lt;STRONG&gt;Table 1 (calculated column added):&amp;nbsp;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;&lt;STRONG&gt;ID, DateA, DateC&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;PRE&gt;&lt;FONT color="#000000"&gt;1, 2019-01-01,&amp;nbsp;2019-01-03
2, 2019-01-02,&amp;nbsp;2019-01-03
3, 2019-01-03,&amp;nbsp;2019-01-04
4, 2019-01-04,&amp;nbsp;2019-01-07
5, 2019-01-05,&amp;nbsp;2019-01-07
6, 2019-01-06,&amp;nbsp;2019-01-07&lt;/FONT&gt;&lt;/PRE&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;I want to add a calculated column to Table 1.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;The logical steps are:&lt;/FONT&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;FONT color="#000000"&gt;Date after date 2019-01-01 in Table 1 is&amp;nbsp;2019-01-02.&lt;/FONT&gt;&lt;/LI&gt;&lt;LI&gt;&lt;FONT color="#000000"&gt;Check if date&amp;nbsp;2019-01-02 is in Table 2.&lt;/FONT&gt;&lt;/LI&gt;&lt;LI&gt;&lt;FONT color="#000000"&gt;If date&amp;nbsp;2019-01-02 is in Table 2 then check if 2019-01-03 is in Table 2.&lt;/FONT&gt;&lt;/LI&gt;&lt;LI&gt;&lt;FONT color="#000000"&gt;Repeat until there is a 'date after' result which is not in Table 2.&lt;/FONT&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;Note: &lt;EM&gt;it is possible that the next date &lt;U&gt;does not exist&lt;/U&gt; in Table 1, so I'm looking for the next date &lt;U&gt;in general&lt;/U&gt;&amp;nbsp;which &lt;U&gt;does not&lt;/U&gt; exist in Table 2. That's why 2019-01-07 is a valid result.&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;EM&gt;I found a solution in Power Query:&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;&lt;EM&gt;&lt;A href="https://community.powerbi.com/t5/Power-Query/Add-column-with-next-date-filtered-by-another-dates-table/m-p/806700/highlight/false#M27054" target="_blank"&gt;https://community.powerbi.com/t5/Power-Query/Add-column-with-next-date-filtered-by-another-dates-table/m-p/806700/highlight/false#M27054&lt;/A&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Oct 2019 12:49:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Next-date-limited-by-another-filter-table-with-dates/m-p/805784#M4992</guid>
      <dc:creator>richard-powerbi</dc:creator>
      <dc:date>2019-10-02T12:49:21Z</dc:date>
    </item>
    <item>
      <title>Re: Next date limited by another 'filter table' with dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Next-date-limited-by-another-filter-table-with-dates/m-p/805913#M4993</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="84144" data-lia-user-login="richard-powerbi" class="lia-mention lia-mention-user"&gt;richard-powerbi&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Not sure if your description is spot on, "&lt;SPAN&gt;In other words, if the date exists in Table 2, the next day&lt;/SPAN&gt;&lt;EM&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;that does not&lt;/EM&gt;&lt;SPAN&gt;&amp;nbsp;exist in Table 2 should be taken." If it does not exist in Table 2, use the day from table 1? Not sure why 1/1 gets a result of 1/1.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;In the meantime, I imagine it will be an if with a lookup.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Let me know about the logic&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.&lt;BR /&gt;Nathaniel&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;check = LOOKUPVALUE('DATE B'[Column1],'DATE B'[Column1],'DATE A'[Column2],1)&lt;/PRE&gt;</description>
      <pubDate>Mon, 30 Sep 2019 17:03:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Next-date-limited-by-another-filter-table-with-dates/m-p/805913#M4993</guid>
      <dc:creator>Nathaniel_C</dc:creator>
      <dc:date>2019-09-30T17:03:23Z</dc:date>
    </item>
    <item>
      <title>Re: Next date limited by another 'filter table' with dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Next-date-limited-by-another-filter-table-with-dates/m-p/806468#M5008</link>
      <description>&lt;P&gt;Thanks &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="159166" data-lia-user-login="Nathaniel_C" class="lia-mention lia-mention-user"&gt;Nathaniel_C&lt;/a&gt; for thinking with me.&lt;/P&gt;&lt;P&gt;I'm sorry, so emberrasing! My result table was not correct. I guess I had a long day behind me. I updated my original post. Still looking for a solution.&lt;/P&gt;</description>
      <pubDate>Tue, 01 Oct 2019 07:17:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Next-date-limited-by-another-filter-table-with-dates/m-p/806468#M5008</guid>
      <dc:creator>richard-powerbi</dc:creator>
      <dc:date>2019-10-01T07:17:14Z</dc:date>
    </item>
    <item>
      <title>Re: Next date limited by another 'filter table' with dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Next-date-limited-by-another-filter-table-with-dates/m-p/807955#M5066</link>
      <description>&lt;P&gt;I found a solution in Power Query, but still interested in how this would go in DAX...&lt;/P&gt;</description>
      <pubDate>Wed, 02 Oct 2019 12:50:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Next-date-limited-by-another-filter-table-with-dates/m-p/807955#M5066</guid>
      <dc:creator>richard-powerbi</dc:creator>
      <dc:date>2019-10-02T12:50:13Z</dc:date>
    </item>
  </channel>
</rss>

