<?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: Return Value from Tbl2 where Tbl1.Value is between two Tbl2.Values in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Return-Value-from-Tbl2-where-Tbl1-Value-is-between-two-Tbl2/m-p/2535547#M71246</link>
    <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="332470" data-lia-user-login="PBI_Inquisitor" class="lia-mention lia-mention-user"&gt;PBI_Inquisitor&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;The use&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;Indicator from T2 = 
VAR CurrentCusomer = T1[CustomerID]
VAR CurrentMonth = T1[MonthID]
VAR T2Start = CALCULATE ( MAX ( T2[StartMonth] ), T2[CustomerID] = CurrentCusomer )
VAR T2End = CALCULATE ( MAX ( T2[EndMonth] ), T2[CustomerID] = CurrentCusomer )
RETURN
    IF ( CurrentMonth &amp;gt;= T2Start &amp;amp;&amp;amp; CurrentMonth &amp;lt;= T2End, 1, 0 )&lt;/LI-CODE&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 24 May 2022 08:42:20 GMT</pubDate>
    <dc:creator>tamerj1</dc:creator>
    <dc:date>2022-05-24T08:42:20Z</dc:date>
    <item>
      <title>Return Value from Tbl2 where Tbl1.Value is between two Tbl2.Values</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Return-Value-from-Tbl2-where-Tbl1-Value-is-between-two-Tbl2/m-p/2533687#M71131</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have two tables T1 &amp;amp; T2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;T1 has&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;CustomerID&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;MonthID&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Indicator from T2&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;12345&lt;/TD&gt;&lt;TD&gt;202301&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;23456&lt;/TD&gt;&lt;TD&gt;202301&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;34567&lt;/TD&gt;&lt;TD&gt;202301&lt;/TD&gt;&lt;TD&gt;0 (Returns 0 as 202301 is NOT between the start and end date in T2&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The &lt;EM&gt;Indicator From T2&lt;/EM&gt; should return when the T1.MonthID is between the start and end months in T2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;T2:&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;CustomerID&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;StartMonth&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;EndMonth&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Indicator&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;12345&lt;/TD&gt;&lt;TD&gt;202301&lt;/TD&gt;&lt;TD&gt;202302&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;12345&lt;/TD&gt;&lt;TD&gt;202302&lt;/TD&gt;&lt;TD&gt;202304&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;12345&lt;/TD&gt;&lt;TD&gt;202303&lt;/TD&gt;&lt;TD&gt;202305&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;23456&lt;/TD&gt;&lt;TD&gt;202301&lt;/TD&gt;&lt;TD&gt;202302&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;34567&lt;/TD&gt;&lt;TD&gt;202302&lt;/TD&gt;&lt;TD&gt;202304&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Tried various thing and either get #ERROR or no values returned&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any advice on best approach please?&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;P&gt;P&lt;/P&gt;</description>
      <pubDate>Tue, 24 May 2022 07:58:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Return-Value-from-Tbl2-where-Tbl1-Value-is-between-two-Tbl2/m-p/2533687#M71131</guid>
      <dc:creator>PBI_Inquisitor</dc:creator>
      <dc:date>2022-05-24T07:58:52Z</dc:date>
    </item>
    <item>
      <title>Re: Return Value from Tbl2 where Tbl1.Value is between two Tbl2.Values</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Return-Value-from-Tbl2-where-Tbl1-Value-is-between-two-Tbl2/m-p/2534215#M71159</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="332470" data-lia-user-login="PBI_Inquisitor" class="lia-mention lia-mention-user"&gt;PBI_Inquisitor&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I assume you can build one to one relationship between the two tables. Then you can create a new calculated column in T1&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Indicator from T2 =&lt;BR /&gt;IF (&lt;BR /&gt;T1[MonthID] &amp;gt;= RELATED ( T2[StartMonth] )&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;&amp;amp;&amp;nbsp;T1[MonthID] &amp;lt;= RELATED ( T2[EndMonth] ),&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;1,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;0&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 23 May 2022 18:56:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Return-Value-from-Tbl2-where-Tbl1-Value-is-between-two-Tbl2/m-p/2534215#M71159</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-05-23T18:56:35Z</dc:date>
    </item>
    <item>
      <title>Re: Return Value from Tbl2 where Tbl1.Value is between two Tbl2.Values</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Return-Value-from-Tbl2-where-Tbl1-Value-is-between-two-Tbl2/m-p/2535405#M71241</link>
      <description>&lt;P&gt;Thanks for your reply&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="317289" data-lia-user-login="tamerj1" class="lia-mention lia-mention-user"&gt;tamerj1&lt;/a&gt;&amp;nbsp;but unfortunately I cant build a 1:1 relationship in this instance - I've updated the Table 2 to show this&lt;/P&gt;</description>
      <pubDate>Tue, 24 May 2022 08:00:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Return-Value-from-Tbl2-where-Tbl1-Value-is-between-two-Tbl2/m-p/2535405#M71241</guid>
      <dc:creator>PBI_Inquisitor</dc:creator>
      <dc:date>2022-05-24T08:00:07Z</dc:date>
    </item>
    <item>
      <title>Re: Return Value from Tbl2 where Tbl1.Value is between two Tbl2.Values</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Return-Value-from-Tbl2-where-Tbl1-Value-is-between-two-Tbl2/m-p/2535547#M71246</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="332470" data-lia-user-login="PBI_Inquisitor" class="lia-mention lia-mention-user"&gt;PBI_Inquisitor&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;The use&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;Indicator from T2 = 
VAR CurrentCusomer = T1[CustomerID]
VAR CurrentMonth = T1[MonthID]
VAR T2Start = CALCULATE ( MAX ( T2[StartMonth] ), T2[CustomerID] = CurrentCusomer )
VAR T2End = CALCULATE ( MAX ( T2[EndMonth] ), T2[CustomerID] = CurrentCusomer )
RETURN
    IF ( CurrentMonth &amp;gt;= T2Start &amp;amp;&amp;amp; CurrentMonth &amp;lt;= T2End, 1, 0 )&lt;/LI-CODE&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 24 May 2022 08:42:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Return-Value-from-Tbl2-where-Tbl1-Value-is-between-two-Tbl2/m-p/2535547#M71246</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-05-24T08:42:20Z</dc:date>
    </item>
    <item>
      <title>Re: Return Value from Tbl2 where Tbl1.Value is between two Tbl2.Values</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Return-Value-from-Tbl2-where-Tbl1-Value-is-between-two-Tbl2/m-p/2535991#M71265</link>
      <description>&lt;P&gt;Thank you so much for your help&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="317289" data-lia-user-login="tamerj1" class="lia-mention lia-mention-user"&gt;tamerj1&lt;/a&gt;&amp;nbsp;- much appreciated&lt;/P&gt;</description>
      <pubDate>Tue, 24 May 2022 11:23:55 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Return-Value-from-Tbl2-where-Tbl1-Value-is-between-two-Tbl2/m-p/2535991#M71265</guid>
      <dc:creator>PBI_Inquisitor</dc:creator>
      <dc:date>2022-05-24T11:23:55Z</dc:date>
    </item>
  </channel>
</rss>

