<?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 How to check if value is in another table with additional condition and print 0 or 1 in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-check-if-value-is-in-another-table-with-additional/m-p/3529425#M135611</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to build a command to first check if a value is in one of two tables while fulfilling a condition, and then print either 0 or 1 to a column. I'm having trouble combining these all to one command.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, first I want to check if a value on table1 is on table2 or table3 AND marked on the same row as type a. If the value is found on either of the tables as type a, then command should return 1 to the column on table 1. Otherwise, if the value is not found or is not marked type a, it should return 0 to the column.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm basically wanting to combine an IF ELSE structure with an additional condition. How could this be done efficiently?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 12 Nov 2023 12:17:29 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2023-11-12T12:17:29Z</dc:date>
    <item>
      <title>How to check if value is in another table with additional condition and print 0 or 1</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-check-if-value-is-in-another-table-with-additional/m-p/3529425#M135611</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to build a command to first check if a value is in one of two tables while fulfilling a condition, and then print either 0 or 1 to a column. I'm having trouble combining these all to one command.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, first I want to check if a value on table1 is on table2 or table3 AND marked on the same row as type a. If the value is found on either of the tables as type a, then command should return 1 to the column on table 1. Otherwise, if the value is not found or is not marked type a, it should return 0 to the column.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm basically wanting to combine an IF ELSE structure with an additional condition. How could this be done efficiently?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 12 Nov 2023 12:17:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-check-if-value-is-in-another-table-with-additional/m-p/3529425#M135611</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-11-12T12:17:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to check if value is in another table with additional condition and print 0 or 1</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-check-if-value-is-in-another-table-with-additional/m-p/3529477#M135614</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;I am not sure if I understood, but here is an attempt:&lt;BR /&gt;&lt;BR /&gt;Table1:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Table2&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Table3:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Here in table1 we have Type A Dimension AA and Type B dimension AA which are found in table 2 or 3 with matching values. These rows should get a value 1 in our dax.&lt;BR /&gt;&lt;BR /&gt;Dax:&lt;/P&gt;
&lt;DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;Test for match &lt;/SPAN&gt;&lt;SPAN&gt;in&lt;/SPAN&gt;&lt;SPAN&gt; tables with matching values &lt;/SPAN&gt;&lt;SPAN&gt;in&lt;/SPAN&gt;&lt;SPAN&gt; filter context =&lt;/SPAN&gt;&lt;/DI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/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;_testTable3&lt;/SPAN&gt;&lt;SPAN&gt; = &amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;COUNTROWS&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;'Table (18)'&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;'Table (18)'&lt;/SPAN&gt;&lt;SPAN&gt;[Type]&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;_type&lt;/SPAN&gt;&lt;SPAN&gt; &amp;amp;&amp;amp; &lt;/SPAN&gt;&lt;SPAN&gt;'Table (18)'&lt;/SPAN&gt;&lt;SPAN&gt;[Column1]&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;_dimension&lt;/SPAN&gt;&lt;SPAN&gt;)) &lt;/SPAN&gt;&lt;SPAN&gt;//filter the test tables with the current context values&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;return&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;IF&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;OR&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;_testTable2&lt;/SPAN&gt;&lt;SPAN&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;_testTable3&lt;/SPAN&gt;&lt;SPAN&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;BR /&gt;&lt;BR /&gt;End Result:&lt;BR /&gt;&lt;BR /&gt;&lt;img /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
The result seems to match the expectation.&lt;BR /&gt;&lt;BR /&gt;I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!&lt;BR /&gt;&lt;BR /&gt;My LinkedIn: &lt;A href="https://www.linkedin.com/in/n%C3%A4ttiahov-00001/" target="_blank"&gt;https://www.linkedin.com/in/n%C3%A4ttiahov-00001/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/DIV&gt;</description>
      <pubDate>Sun, 12 Nov 2023 13:40:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-check-if-value-is-in-another-table-with-additional/m-p/3529477#M135614</guid>
      <dc:creator>ValtteriN</dc:creator>
      <dc:date>2023-11-12T13:40:35Z</dc:date>
    </item>
  </channel>
</rss>

