<?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: Problem with many to many lookup in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Problem-with-many-to-many-lookup/m-p/2350897#M59661</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="225395" data-lia-user-login="MJEnnis" class="lia-mention lia-mention-user"&gt;MJEnnis&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;I was working on something and I encountered a situation that reminded me of your problem. My issue was quite different but it reminded me that small thngs can become big issues. So I went back to your sample data, copied it into excel and uploaded it into PowerBi.&lt;BR /&gt;I wanted to know what would happen if I have only two similar dates in table one.&lt;BR /&gt;I changed the code replacing SELECTEDVALUE with COUNTROWS just to know how many rows are returned. If more thant one then the outcome of selected value would be "blank". This is what I got&lt;BR /&gt;&lt;img /&gt;&lt;BR /&gt;Actually all the Table 2 dates which are less than or equal to Table 1 date (either min or max depending on the function you used) will resuly in blank in the calculated column as they return a table of 2 rows&amp;nbsp;&lt;BR /&gt;Only one duplicated date resulted in around 10 blanks in an extremely tiny data set. The actual data set will result in a huge number of blanks as happend with you.&lt;/P&gt;</description>
    <pubDate>Mon, 21 Feb 2022 10:51:27 GMT</pubDate>
    <dc:creator>tamerj1</dc:creator>
    <dc:date>2022-02-21T10:51:27Z</dc:date>
    <item>
      <title>Problem with many to many lookup</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Problem-with-many-to-many-lookup/m-p/2348710#M59504</link>
      <description>&lt;P&gt;I am having trouble creating a filter column based on a calcuation in another table. It is something I have done several times, but it just isn't working here.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the basic structure of the reference table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;ID&lt;/TD&gt;&lt;TD&gt;End_Date&lt;/TD&gt;&lt;TD&gt;Filter-2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;143&lt;/TD&gt;&lt;TD&gt;19.02.22 00:00&lt;/TD&gt;&lt;TD&gt;UNKNOWN&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;448&lt;/TD&gt;&lt;TD&gt;10.10.14 00:00&lt;/TD&gt;&lt;TD&gt;NO&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;448&lt;/TD&gt;&lt;TD&gt;21.03.19 00:00&lt;/TD&gt;&lt;TD&gt;NO&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1369&lt;/TD&gt;&lt;TD&gt;23.07.14 00:00&lt;/TD&gt;&lt;TD&gt;UNKNOWN&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;36464&lt;/TD&gt;&lt;TD&gt;30.09.19 00:00&lt;/TD&gt;&lt;TD&gt;UNKNOWN&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;36464&lt;/TD&gt;&lt;TD&gt;19.02.22 00:00&lt;/TD&gt;&lt;TD&gt;NO&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;36464&lt;/TD&gt;&lt;TD&gt;30.09.20 00:00&lt;/TD&gt;&lt;TD&gt;NO&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And here is the table where I need to create a filter column.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY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lt;/TD&gt;&lt;TD&gt;L3&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;36464&lt;/TD&gt;&lt;TD&gt;14.01.22 00:00&lt;/TD&gt;&lt;TD&gt;L1&lt;/TD&gt;&lt;TD&gt;19.02.22 00:00&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;36464&lt;/TD&gt;&lt;TD&gt;04.10.18 00:00&lt;/TD&gt;&lt;TD&gt;L2&lt;/TD&gt;&lt;TD&gt;30.09.19 00:00&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;36464&lt;/TD&gt;&lt;TD&gt;15.01.18 00:00&lt;/TD&gt;&lt;TD&gt;L3&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;36464&lt;/TD&gt;&lt;TD&gt;20.04.17 00:00&lt;/TD&gt;&lt;TD&gt;L2&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As you can see, I had no problem creating the Filter-1 column (from a third table), using basically the same strategy. But the Filter-2 column has multiple blanks. I have played around with it in different ways (e.g., MIN(), MAX(), etc.), and it does change which rows return the correct value, but there are always several blanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the code I am using:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Filter-2 = 

Var End_Date = CALCULATE(MIN('Table1'[End_Date]), FILTER('Table1',
    'Table1'[ID] = 'Table2'[ID] &amp;amp;&amp;amp;
    'Table1'[End_Date] &amp;gt;= 'Table2'[Date])
    )

Var Filter_2 = CALCULATE(SELECTEDVALUE('Table1'[Filter-2]), FILTER(
    'Table1', 
    'Table1'[ID] = 'Table2'[ID] &amp;amp;&amp;amp;
    'Table1'[End Date] = End_Date)
    )

RETURN Filter_2&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;Any ideas?&lt;/P&gt;</description>
      <pubDate>Sat, 19 Feb 2022 17:12:02 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Problem-with-many-to-many-lookup/m-p/2348710#M59504</guid>
      <dc:creator>MJEnnis</dc:creator>
      <dc:date>2022-02-19T17:12:02Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with many to many lookup</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Problem-with-many-to-many-lookup/m-p/2348712#M59505</link>
      <description>&lt;P&gt;Note that in the second table above, I was testing to see if the correct end_date was being returned. The correct Filter_2 is returned in the exact same cells.&lt;/P&gt;</description>
      <pubDate>Sat, 19 Feb 2022 08:51:58 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Problem-with-many-to-many-lookup/m-p/2348712#M59505</guid>
      <dc:creator>MJEnnis</dc:creator>
      <dc:date>2022-02-19T08:51:58Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with many to many lookup</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Problem-with-many-to-many-lookup/m-p/2348742#M59513</link>
      <description>&lt;P&gt;Hi Ennis,&lt;/P&gt;&lt;P&gt;Are the tables connected with Many-Many realtionship?&lt;/P&gt;</description>
      <pubDate>Sat, 19 Feb 2022 10:56:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Problem-with-many-to-many-lookup/m-p/2348742#M59513</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-02-19T10:56:42Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with many to many lookup</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Problem-with-many-to-many-lookup/m-p/2348745#M59515</link>
      <description>&lt;P&gt;No, no connection at all yet. But there is also no connection to the third table with the Filter-1 data.&lt;/P&gt;</description>
      <pubDate>Sat, 19 Feb 2022 11:04:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Problem-with-many-to-many-lookup/m-p/2348745#M59515</guid>
      <dc:creator>MJEnnis</dc:creator>
      <dc:date>2022-02-19T11:04:50Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with many to many lookup</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Problem-with-many-to-many-lookup/m-p/2348750#M59517</link>
      <description>&lt;P&gt;It is very clear that Filter-2 in the 2nd table is working only when there is only one value in table 1. Otherwise it returns a blank.&lt;BR /&gt;I believe it is more feasible to use relationships and utilize REALTEDTABLE to grap the table of related values, then it would much easier to get the max or min or whatever is required by your calculation.&lt;BR /&gt;By the way , I can only see two tables. Where is the third one?&lt;/P&gt;</description>
      <pubDate>Sat, 19 Feb 2022 11:20:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Problem-with-many-to-many-lookup/m-p/2348750#M59517</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-02-19T11:20:52Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with many to many lookup</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Problem-with-many-to-many-lookup/m-p/2348751#M59518</link>
      <description>&lt;P&gt;Maybe I need to try MINX() to retrieve the end_date?&lt;/P&gt;</description>
      <pubDate>Sat, 19 Feb 2022 11:23:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Problem-with-many-to-many-lookup/m-p/2348751#M59518</guid>
      <dc:creator>MJEnnis</dc:creator>
      <dc:date>2022-02-19T11:23:04Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with many to many lookup</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Problem-with-many-to-many-lookup/m-p/2348767#M59520</link>
      <description>&lt;P&gt;ID 143 and 1369 only have one row in the reference table, yet they still return several blanks. 36464, on the other hand, has three rows with three different values for the [End Date] and two for [FILTER-2]. Yet returns some of the correct results for two of the rows and nothing for the other.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 19 Feb 2022 11:39:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Problem-with-many-to-many-lookup/m-p/2348767#M59520</guid>
      <dc:creator>MJEnnis</dc:creator>
      <dc:date>2022-02-19T11:39:49Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with many to many lookup</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Problem-with-many-to-many-lookup/m-p/2348770#M59521</link>
      <description>&lt;P&gt;FILTER-1 works properly. So I have not included the reference table or code to get that. But the situations is identical conceptually.&lt;/P&gt;</description>
      <pubDate>Sat, 19 Feb 2022 11:41:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Problem-with-many-to-many-lookup/m-p/2348770#M59521</guid>
      <dc:creator>MJEnnis</dc:creator>
      <dc:date>2022-02-19T11:41:20Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with many to many lookup</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Problem-with-many-to-many-lookup/m-p/2348782#M59525</link>
      <description>&lt;P&gt;Can you share a sample file?&lt;/P&gt;</description>
      <pubDate>Sat, 19 Feb 2022 11:53:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Problem-with-many-to-many-lookup/m-p/2348782#M59525</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-02-19T11:53:07Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with many to many lookup</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Problem-with-many-to-many-lookup/m-p/2348853#M59533</link>
      <description>&lt;P&gt;Thanks for the offer. But it is institutional data that cannot be shared. In the meantime, I have found a workaround. Very strange, but if I bring the F-Filter2 column into the third (not shown) calculated table where F-Filter 1 is in turn calculated, I have no problem looking up F-Filter2 from that table. There must be some sort of interdependence caused by calculations that is causing this problem. But I will leave this question unsolved in case somewhat out there can figure out why the direct lookup doesn't work...&lt;/P&gt;</description>
      <pubDate>Sat, 19 Feb 2022 15:07:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Problem-with-many-to-many-lookup/m-p/2348853#M59533</guid>
      <dc:creator>MJEnnis</dc:creator>
      <dc:date>2022-02-19T15:07:38Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with many to many lookup</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Problem-with-many-to-many-lookup/m-p/2348888#M59537</link>
      <description>&lt;P&gt;SELECTEDVALUE returns blank incase multiple values were found. Maybe you have records having same ID and date.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 19 Feb 2022 16:00:01 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Problem-with-many-to-many-lookup/m-p/2348888#M59537</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-02-19T16:00:01Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with many to many lookup</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Problem-with-many-to-many-lookup/m-p/2348896#M59540</link>
      <description>&lt;P&gt;It is unlikely that two entries for the same ID have the same end date, given the nature of the data. Even if there are one or two such occurences in the database (which, again, is unlikely), that would not explain the blanks shown above...&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But I did think of that, which is why I tried MAX() and MIN() to test it out. The blanks/results ended up in different cells, which is strange.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The weirdest thing is that I have no problem pulling the data into and then from the calculated table for Filter-1. The code is different, but basically works the same way...&lt;/P&gt;</description>
      <pubDate>Sat, 19 Feb 2022 16:05:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Problem-with-many-to-many-lookup/m-p/2348896#M59540</guid>
      <dc:creator>MJEnnis</dc:creator>
      <dc:date>2022-02-19T16:05:16Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with many to many lookup</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Problem-with-many-to-many-lookup/m-p/2348916#M59542</link>
      <description>&lt;P&gt;It is the context transition. CALCULATE converts the row into a filter. If the date in table 2 is missing in Table 1 then the date in the filter context is empty and CALCULATE returns blank.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 19 Feb 2022 16:54:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Problem-with-many-to-many-lookup/m-p/2348916#M59542</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-02-19T16:54:43Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with many to many lookup</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Problem-with-many-to-many-lookup/m-p/2348923#M59543</link>
      <description>&lt;P&gt;All rows in Table 1 have an End Date. And the VAR End_Date calculated in the calculated column of Table 2 matches the date in Table1 (as seen in the copied entries above). It is just that CALCULATE is retrieving the match for some rows in Table 2 and not for others. If I replace SELECTEDVALUE with MIN or MAX, then it retrieves the correct date for different rows. I think for some reason&amp;nbsp;CALCULATE(MIN('Table1'[End_Date])... is not working the way I expect it too.&lt;/P&gt;</description>
      <pubDate>Sat, 19 Feb 2022 17:11:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Problem-with-many-to-many-lookup/m-p/2348923#M59543</guid>
      <dc:creator>MJEnnis</dc:creator>
      <dc:date>2022-02-19T17:11:15Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with many to many lookup</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Problem-with-many-to-many-lookup/m-p/2348950#M59546</link>
      <description>&lt;P&gt;In the first CCALCULATE, try to store&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Table2'[Date]&lt;/PRE&gt;&lt;P&gt;in a variable outside CALCULATE &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 19 Feb 2022 18:06:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Problem-with-many-to-many-lookup/m-p/2348950#M59546</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-02-19T18:06:14Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with many to many lookup</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Problem-with-many-to-many-lookup/m-p/2350897#M59661</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="225395" data-lia-user-login="MJEnnis" class="lia-mention lia-mention-user"&gt;MJEnnis&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;I was working on something and I encountered a situation that reminded me of your problem. My issue was quite different but it reminded me that small thngs can become big issues. So I went back to your sample data, copied it into excel and uploaded it into PowerBi.&lt;BR /&gt;I wanted to know what would happen if I have only two similar dates in table one.&lt;BR /&gt;I changed the code replacing SELECTEDVALUE with COUNTROWS just to know how many rows are returned. If more thant one then the outcome of selected value would be "blank". This is what I got&lt;BR /&gt;&lt;img /&gt;&lt;BR /&gt;Actually all the Table 2 dates which are less than or equal to Table 1 date (either min or max depending on the function you used) will resuly in blank in the calculated column as they return a table of 2 rows&amp;nbsp;&lt;BR /&gt;Only one duplicated date resulted in around 10 blanks in an extremely tiny data set. The actual data set will result in a huge number of blanks as happend with you.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Feb 2022 10:51:27 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Problem-with-many-to-many-lookup/m-p/2350897#M59661</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-02-21T10:51:27Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with many to many lookup</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Problem-with-many-to-many-lookup/m-p/2355054#M59930</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="225395" data-lia-user-login="MJEnnis" class="lia-mention lia-mention-user"&gt;MJEnnis&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We do not use selectedvalue when create column but [column name] directly. And if we want get filter result form table1 where table1 id = table2 id, we need to use eariler() function.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So please try the following code to get the min date depend on ID from table 1:&lt;/P&gt;
&lt;LI-CODE lang="c"&gt;Filter-2 =
CALCULATE(
    MIN( 'Table1'[End_Date] ),
    FILTER(
        'Table1',
        'Table1'[ID] = EARLIER( 'Table2'[ID] )
            &amp;amp;&amp;amp; 'Table1'[End_Date] &amp;gt;= EARLIER( 'Table2'[Date] )
    )
)
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Pbix in the end you can refer.&lt;/P&gt;
&lt;P&gt;Best Regards&lt;/P&gt;
&lt;P&gt;Community Support Team _ chenwu zhu&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Feb 2022 06:52:41 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Problem-with-many-to-many-lookup/m-p/2355054#M59930</guid>
      <dc:creator>v-chenwuz-msft</dc:creator>
      <dc:date>2022-02-23T06:52:41Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with many to many lookup</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Problem-with-many-to-many-lookup/m-p/2359737#M60258</link>
      <description>&lt;P&gt;Thanks a lot for the suggestion. The code you propose doesn't really produce the result I have explained above. Moreover, I managed to get it to work with SELECTEDVALUE() and without EARLIER(). Will see about using the column name directly in the future.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Feb 2022 21:31:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Problem-with-many-to-many-lookup/m-p/2359737#M60258</guid>
      <dc:creator>MJEnnis</dc:creator>
      <dc:date>2022-02-24T21:31:23Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with many to many lookup</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Problem-with-many-to-many-lookup/m-p/2359765#M60261</link>
      <description>&lt;P&gt;Yes, something like this was going on. I do not know that the number of rows returned in your code is the (only) issue, though. As it clearly does not not account for all of the blanks. ID 143, for instance, only has one entry in the reference table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To solve it, I had to add two other columns column to the filters , also refering to the start date (not shown above). I thought that calculating the MIN('Table1'[End_Date]) for each row was a crafty way to account for all possibilities, but it just wouldn't work. Not even for ID 143, even though the only possible date for each and every row is&amp;nbsp;19.02.22 00:00. Anyway, this is what eventually worked. (A couple of the conditions are not necessary yet, but may become necessary in the future. So they are there just to cover all my bases.)&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;LI-CODE lang="markup"&gt;NewFilter = 

Var Lang = LOOKUPVALUE('TABLE3'[Language], 'TABLE3'[Event ID], LOOKUPVALUE('TABLE4'[Event ID], 'TABLE4'[Session ID], 'TABLE3'[Session ID])
)

Var EndDate1 = Calculate(SELECTEDVALUE(‘TABLE1’[End_Date]), FILTER(‘TABLE1’, ‘TABLE1’[ID] = 'TABLE2'[ID]
    &amp;amp;&amp;amp; ‘TABLE1’[Language] = Lang
    &amp;amp;&amp;amp; AND(‘TABLE1’[End_Date] &amp;gt;= 'TABLE2'[Date], ‘TABLE1’[Start_Date] &amp;lt;= 'TABLE2'[Date]))
    )

Var EndDate2 = Calculate(SELECTEDVALUE(‘TABLE1’[End_Date]), FILTER(‘TABLE1’, ‘TABLE1’[ID] = 'TABLE2'[ID]
    &amp;amp;&amp;amp; ‘TABLE1’[Language] = Lang
    &amp;amp;&amp;amp; ‘TABLE1’[End_Date] &amp;gt; 'TABLE2'[Date])
    )

Var EndDate3 = Calculate(MAX(‘TABLE1’[End_Date]), FILTER(‘TABLE1’, ‘TABLE1’[ID] = 'TABLE2'[ID]
    &amp;amp;&amp;amp; ‘TABLE1’[Language] = Lang
    &amp;amp;&amp;amp; ‘TABLE1’[End_Date] &amp;gt; 'TABLE2'[Date])
    )

Var EndDate4 = Calculate(SELECTEDVALUE(‘TABLE1’[End_Date]), FILTER(‘TABLE1’, ‘TABLE1’[ID] = 'TABLE2'[ID]
    &amp;amp;&amp;amp; ‘TABLE1’[Language] = Lang
    &amp;amp;&amp;amp; ‘TABLE1’[End_Date] &amp;gt; 'TABLE2'[Date]
    &amp;amp;&amp;amp; ‘TABLE1’[End_Date] &amp;lt;&amp;gt; EndDate3)
    )

Var EndDate5 = Calculate(MIN(‘TABLE1’[End_Date]), FILTER(‘TABLE1’, ‘TABLE1’[ID] = 'TABLE2'[ID]
    &amp;amp;&amp;amp; ‘TABLE1’[Language] = Lang
    &amp;amp;&amp;amp; ‘TABLE1’[End_Date] &amp;gt; 'TABLE2'[Date])
    )

Var EndDate6 = Calculate(SELECTEDVALUE(‘TABLE1’[End_Date]), FILTER(‘TABLE1’, ‘TABLE1’[ID] = 'TABLE2'[ID]
    &amp;amp;&amp;amp; ‘TABLE1’[Language] = Lang
    &amp;amp;&amp;amp; ‘TABLE1’[End_Date] &amp;gt; 'TABLE2'[Date]
    &amp;amp;&amp;amp; ‘TABLE1’[End_Date] &amp;lt;&amp;gt; EndDate3
    &amp;amp;&amp;amp; ‘TABLE1’[End_Date] &amp;lt;&amp;gt; EndDate5)
    )

Var EndDate = IF(NOT(ISBLANK(EndDate1)), EndDate1, 
IF(NOT(ISBLANK(EndDate2)), EndDate2, 
IF(NOT(ISBLANK(EndDate4)), Enddate4,
IF(NOT(ISBLANK(EndDate5)), Enddate5,
IF(NOT(ISBLANK(EndDate6)), Enddate6,
IF(NOT(ISBLANK(EndDate3)), Enddate3,
BLANK()
))))))

Var StartDate1 = Calculate(Max(‘TABLE1’[Start_Date]), FILTER(‘TABLE1’, ‘TABLE1’[ID] = 'TABLE2'[ID]
    &amp;amp;&amp;amp; ‘TABLE1’[Language] = Lang
    &amp;amp;&amp;amp; AND(‘TABLE1’[End_Date] &amp;gt; 'TABLE2'[Date], ‘TABLE1’[Start_Date] &amp;lt; 'TABLE2'[Date]))
    )

Var StartDate2 = Calculate(MIN(‘TABLE1’[Start_Date]), FILTER(‘TABLE1’, ‘TABLE1’[ID] = 'TABLE2'[ID]
    &amp;amp;&amp;amp; ‘TABLE1’[Language] = Lang
    &amp;amp;&amp;amp; AND(‘TABLE1’[End_Date] &amp;gt; 'TABLE2'[Date], ‘TABLE1’[Start_Date] &amp;lt; 'TABLE2'[Date]))
    )

Var StartDate3 = Calculate(SELECTEDVALUE(‘TABLE1’[Start_Date]), FILTER(‘TABLE1’, ‘TABLE1’[ID] = 'TABLE2'[ID]
    &amp;amp;&amp;amp; ‘TABLE1’[Language] = Lang
    &amp;amp;&amp;amp; AND(‘TABLE1’[End_Date] &amp;gt; 'TABLE2'[Date], ‘TABLE1’[Start_Date] &amp;lt; 'TABLE2'[Date])
    &amp;amp;&amp;amp; ‘TABLE1’[Start_Date] &amp;lt;&amp;gt; StartDate1
    &amp;amp;&amp;amp; ‘TABLE1’[Start_Date] &amp;lt;&amp;gt; StartDate2)
    )

Var StartDate4 = Calculate(Min(‘TABLE1’[Start_Date]), FILTER(‘TABLE1’, ‘TABLE1’[ID] = 'TABLE2'[ID]
    &amp;amp;&amp;amp; ‘TABLE1’[Language] = Lang
    &amp;amp;&amp;amp; AND(‘TABLE1’[End_Date] &amp;gt; 'TABLE2'[Date], ‘TABLE1’[Start_Date] &amp;gt; 'TABLE2'[Date]))
    )

Var StartDate5 = Calculate(Max(‘TABLE1’[Start_Date]), FILTER(‘TABLE1’, ‘TABLE1’[ID] = 'TABLE2'[ID]
    &amp;amp;&amp;amp; ‘TABLE1’[Language] = Lang
    &amp;amp;&amp;amp; AND(‘TABLE1’[End_Date] &amp;gt; 'TABLE2'[Date], ‘TABLE1’[Start_Date] &amp;gt; 'TABLE2'[Date]))
    )

Var StartDate = IF(NOT(ISBLANK(StartDate1)), StartDate1, 
IF(NOT(ISBLANK(StartDate2)), StartDate2, 
IF(NOT(ISBLANK(StartDate3)), StartDate3, 
IF(NOT(ISBLANK(StartDate4)), StartDate4,
IF(NOT(ISBLANK(StartDate5)), StartDate5,
BLANK()
)))))

Var NewFilter = CALCULATE(SELECTEDVALUE(‘TABLE1’[True Beginner L3]), FILTER(
    ‘TABLE1’, ‘TABLE1’[ID] = 'TABLE2'[ID]
    &amp;amp;&amp;amp; ‘TABLE1’[Language] = Lang
    &amp;amp;&amp;amp; ‘TABLE1’[End_Date] = EndDate)
)

Var NewFilter2 = CALCULATE(SELECTEDVALUE(‘TABLE1’[True Beginner L3]), FILTER(
    ‘TABLE1’, ‘TABLE1’[ID] = 'TABLE2'[ID]
    &amp;amp;&amp;amp; ‘TABLE1’[Language] = Lang
    &amp;amp;&amp;amp; ‘TABLE1’[Start_Date] = StartDate)
)

Var NewFilter3 = IF(NOT(ISBLANK(NewFilter)), NewFilter, NewFilter2
)

RETURN NewFilter3&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;</description>
      <pubDate>Thu, 24 Feb 2022 22:20:44 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Problem-with-many-to-many-lookup/m-p/2359765#M60261</guid>
      <dc:creator>MJEnnis</dc:creator>
      <dc:date>2022-02-24T22:20:44Z</dc:date>
    </item>
  </channel>
</rss>

