<?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: check if the specific value is in related tablecolumn and set to 1 in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/check-if-the-specific-value-is-in-related-tablecolumn-and-set-to/m-p/1755388#M36632</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="292827" data-lia-user-login="jelleschuurman" class="lia-mention lia-mention-user"&gt;jelleschuurman&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;for this to work you would have to add a unique Index-Column in PowerQuery, otherwise DAX can´t evaluate this case.&lt;/P&gt;&lt;P&gt;(&lt;A href="https://sqlskull.com/2020/09/08/create-index-column-using-a-power-query/" target="_blank"&gt;https://sqlskull.com/2020/09/08/create-index-column-using-a-power-query/&lt;/A&gt;)&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After adding the index column my table looks like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;To create the column you are looking for i used this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;&lt;SPAN&gt;YourColumn = &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;var _currentID = Dossier[DossierID]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;var _currentDate = Dossier[Date]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;var _currentIndex = Dossier[Index]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;RETURN&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;IF(COUNTX(FILTER(Dossier, Dossier[DossierID] = _currentID &amp;amp;&amp;amp; Dossier[Date] = _currentDate &amp;amp;&amp;amp; Dossier[Index] &amp;lt; _currentIndex), Dossier[Index]) &amp;gt; 0, 0, 1)&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Markus&lt;/P&gt;</description>
    <pubDate>Tue, 30 Mar 2021 17:01:02 GMT</pubDate>
    <dc:creator>Markus_Re</dc:creator>
    <dc:date>2021-03-30T17:01:02Z</dc:date>
    <item>
      <title>check if the specific value is in related tablecolumn and set to 1</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/check-if-the-specific-value-is-in-related-tablecolumn-and-set-to/m-p/1746017#M36311</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm relatively new to DAX.&lt;/P&gt;&lt;P&gt;I have 2 related tables (Azure SQL database). Appointments and Actions. They are connected via AppointmentID.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Every Appointment has 1 or more Actions. What I want to do is, If one or more Actions have the value "C90", set the value of _noShowAppointment to 1.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried with different types of formulas but I wont get the good result. What is the correct formula to do this? Am I even close to the correct formula? I tried among other things this formulas (column is made in Appointments table):&amp;nbsp;&lt;/P&gt;&lt;P&gt;_noShowAppointment = CALCULATE( COUNTROWS(actions),FILTER(actions,action[tariefCode]="C90"))&lt;BR /&gt;_noShowAppointments= if(SEARCH("C90",LOOKUPVALUE(action[tariefCode],action[appointmentId],appointment[appointmentid]),1,0),1,0)&lt;BR /&gt;_noShowAppointments = COUNTX(action,action[tariefCode]="C90")&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Thank you for your help.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Jelle&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Mar 2021 15:38:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/check-if-the-specific-value-is-in-related-tablecolumn-and-set-to/m-p/1746017#M36311</guid>
      <dc:creator>jelleschuurman</dc:creator>
      <dc:date>2021-03-25T15:38:50Z</dc:date>
    </item>
    <item>
      <title>Re: check if the specific value is in related tablecolumn and set to 1</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/check-if-the-specific-value-is-in-related-tablecolumn-and-set-to/m-p/1746328#M36316</link>
      <description>&lt;P&gt;The database looks like this:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Mar 2021 17:43:37 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/check-if-the-specific-value-is-in-related-tablecolumn-and-set-to/m-p/1746328#M36316</guid>
      <dc:creator>jelleschuurman</dc:creator>
      <dc:date>2021-03-25T17:43:37Z</dc:date>
    </item>
    <item>
      <title>Re: check if the specific value is in related tablecolumn and set to 1</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/check-if-the-specific-value-is-in-related-tablecolumn-and-set-to/m-p/1752670#M36563</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="292827" data-lia-user-login="jelleschuurman" class="lia-mention lia-mention-user"&gt;jelleschuurman&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;here is how i would solve this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;&lt;SPAN&gt;_noShowAppointment = &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;IF(COUNTX(FILTER(RELATEDTABLE(Actions), Actions[Tariefcode] = "C90"), Appointments[Appointmentid]) &amp;gt; 0, 1, 0)&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/DIV&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Markus&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT size="2" color="#808080"&gt;Did this answer your question? Mark my post as a solution!&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Mar 2021 19:19:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/check-if-the-specific-value-is-in-related-tablecolumn-and-set-to/m-p/1752670#M36563</guid>
      <dc:creator>Markus_Re</dc:creator>
      <dc:date>2021-03-29T19:19:13Z</dc:date>
    </item>
    <item>
      <title>Re: check if the specific value is in related tablecolumn and set to 1</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/check-if-the-specific-value-is-in-related-tablecolumn-and-set-to/m-p/1755156#M36620</link>
      <description>&lt;P&gt;Thank you. I have another similar question, but then for the same table.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the database:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Is it possible to calculate this?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Mar 2021 15:06:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/check-if-the-specific-value-is-in-related-tablecolumn-and-set-to/m-p/1755156#M36620</guid>
      <dc:creator>jelleschuurman</dc:creator>
      <dc:date>2021-03-30T15:06:49Z</dc:date>
    </item>
    <item>
      <title>Re: check if the specific value is in related tablecolumn and set to 1</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/check-if-the-specific-value-is-in-related-tablecolumn-and-set-to/m-p/1755388#M36632</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="292827" data-lia-user-login="jelleschuurman" class="lia-mention lia-mention-user"&gt;jelleschuurman&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;for this to work you would have to add a unique Index-Column in PowerQuery, otherwise DAX can´t evaluate this case.&lt;/P&gt;&lt;P&gt;(&lt;A href="https://sqlskull.com/2020/09/08/create-index-column-using-a-power-query/" target="_blank"&gt;https://sqlskull.com/2020/09/08/create-index-column-using-a-power-query/&lt;/A&gt;)&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After adding the index column my table looks like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;To create the column you are looking for i used this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;&lt;SPAN&gt;YourColumn = &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;var _currentID = Dossier[DossierID]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;var _currentDate = Dossier[Date]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;var _currentIndex = Dossier[Index]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;RETURN&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;IF(COUNTX(FILTER(Dossier, Dossier[DossierID] = _currentID &amp;amp;&amp;amp; Dossier[Date] = _currentDate &amp;amp;&amp;amp; Dossier[Index] &amp;lt; _currentIndex), Dossier[Index]) &amp;gt; 0, 0, 1)&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Markus&lt;/P&gt;</description>
      <pubDate>Tue, 30 Mar 2021 17:01:02 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/check-if-the-specific-value-is-in-related-tablecolumn-and-set-to/m-p/1755388#M36632</guid>
      <dc:creator>Markus_Re</dc:creator>
      <dc:date>2021-03-30T17:01:02Z</dc:date>
    </item>
    <item>
      <title>Re: check if the specific value is in related tablecolumn and set to 1</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/check-if-the-specific-value-is-in-related-tablecolumn-and-set-to/m-p/1755425#M36636</link>
      <description>&lt;P&gt;I tried this measure; It seems to give the correct result. Is this the best way to do this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;if(CALCULATE(SUM('Table'[DossierID]), ALLSELECTED('Table'[Date])),1,0)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Thank you &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 30 Mar 2021 17:24:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/check-if-the-specific-value-is-in-related-tablecolumn-and-set-to/m-p/1755425#M36636</guid>
      <dc:creator>jelleschuurman</dc:creator>
      <dc:date>2021-03-30T17:24:53Z</dc:date>
    </item>
    <item>
      <title>Re: check if the specific value is in related tablecolumn and set to 1</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/check-if-the-specific-value-is-in-related-tablecolumn-and-set-to/m-p/1755437#M36637</link>
      <description>&lt;P&gt;Thank you. I just saw your comment and it differs from the 'solution' I thought I found (previous post).&amp;nbsp; It also seems to work (but I only used it on a very small table). I'm interessested what i'm missing &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;</description>
      <pubDate>Tue, 30 Mar 2021 17:34:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/check-if-the-specific-value-is-in-related-tablecolumn-and-set-to/m-p/1755437#M36637</guid>
      <dc:creator>jelleschuurman</dc:creator>
      <dc:date>2021-03-30T17:34:25Z</dc:date>
    </item>
    <item>
      <title>Re: check if the specific value is in related tablecolumn and set to 1</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/check-if-the-specific-value-is-in-related-tablecolumn-and-set-to/m-p/1757186#M36702</link>
      <description>&lt;P&gt;It depends on your usecase. Sometimes I prefer to use a calculated column instead of a Measure, but if your Formula works for you, thats great too&lt;span class="lia-unicode-emoji" title=":grinning_face:"&gt;😀&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Mar 2021 10:25:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/check-if-the-specific-value-is-in-related-tablecolumn-and-set-to/m-p/1757186#M36702</guid>
      <dc:creator>Markus_Re</dc:creator>
      <dc:date>2021-03-31T10:25:08Z</dc:date>
    </item>
  </channel>
</rss>

