<?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: Compare two fields to populate a new column in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Compare-two-fields-to-populate-a-new-column/m-p/2645764#M77832</link>
    <description>&lt;P&gt;I very much appreciate the assistance from users on this forum!&amp;nbsp; I found that the solution for my situation was that I needed to do more in Power Query, rather than expecting to do column comparisons in the service.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I first did a 'merge queries', bringing the two userid fields into one merged table.&amp;nbsp; From there, I added a custom column using an IF statement, populating my new column with data from the existing 'comments' column only if the two userIDs were different.&amp;nbsp; If they were the same, I put "remove" into the new column, instead of the comments.&amp;nbsp; Then, in a next step, I filtered rows and removed all rows containing the string "remove".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've got to remember that Power Query is where all the action is.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks!&lt;/P&gt;</description>
    <pubDate>Mon, 18 Jul 2022 19:34:34 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2022-07-18T19:34:34Z</dc:date>
    <item>
      <title>Compare two fields to populate a new column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Compare-two-fields-to-populate-a-new-column/m-p/2641876#M77584</link>
      <description>&lt;P&gt;I want to do a simple thing...&lt;/P&gt;&lt;P&gt;I want to compare two columns on my report.&amp;nbsp; If they're the same, I want a new column that says "Yes".&lt;/P&gt;&lt;P&gt;(I'm trying to see if comments were entered by an employee or his supervisor).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This doesn't work:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;Column = if([CreatedByUser] = RELATED('Workers(2)'[User]), "Yes")&lt;/STRONG&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;The error is&lt;EM&gt; "The column 'Workers(2)[User]' either doesn't exist or doesn't have a relationship to any table available in the current context."&lt;/EM&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;So what's the deal?&amp;nbsp; Do the two tables have to be &lt;EM&gt;directly&lt;/EM&gt; linked?&amp;nbsp; I can't do that...&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;These snips show the two fields that I'm trying to compare:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;img /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;img /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;img /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 15 Jul 2022 17:08:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Compare-two-fields-to-populate-a-new-column/m-p/2641876#M77584</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-07-15T17:08:47Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two fields to populate a new column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Compare-two-fields-to-populate-a-new-column/m-p/2641908#M77586</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please check if it helps&amp;nbsp;&lt;A href="https://community.powerbi.com/t5/Desktop/The-column-x-either-doesn-t-exist-or-doesn-t-have-a-relationship/td-p/1546078" target="_blank"&gt;Solved: The column x either doesn't exist or doesn't have ... - Microsoft Power BI Community&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ritesh&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jul 2022 17:21:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Compare-two-fields-to-populate-a-new-column/m-p/2641908#M77586</guid>
      <dc:creator>ribisht17</dc:creator>
      <dc:date>2022-07-15T17:21:34Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two fields to populate a new column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Compare-two-fields-to-populate-a-new-column/m-p/2641909#M77587</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt;&amp;nbsp;you can use LOOKUPVALUE:&lt;BR /&gt;&lt;A href="https://www.youtube.com/watch?v=XTkrNdU6jWs" target="_blank"&gt;https://www.youtube.com/watch?v=XTkrNdU6jWs&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;A href="https://www.spartabi.com" target="_blank" rel="noopener"&gt;&lt;img /&gt;&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://www.spartabi.com" target="_blank" rel="noopener"&gt;&lt;img /&gt;&lt;/A&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;A href="https://www.linkedin.com/company/spartabi" target="_blank" rel="noopener"&gt;&lt;img /&gt;&lt;/A&gt; &amp;nbsp;&amp;nbsp;&lt;A href="https://www.facebook.com/SpartaBI" target="_blank" rel="noopener"&gt;&lt;img /&gt;&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://community.powerbi.com/t5/Data-Stories-Gallery/Contoso-by-SpartaBI/m-p/2449543" target="_blank" rel="noopener"&gt;&lt;FONT size="4" color="#0000EE"&gt;Showcase Report – Contoso By SpartaBI&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jul 2022 17:21:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Compare-two-fields-to-populate-a-new-column/m-p/2641909#M77587</guid>
      <dc:creator>SpartaBI</dc:creator>
      <dc:date>2022-07-15T17:21:59Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two fields to populate a new column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Compare-two-fields-to-populate-a-new-column/m-p/2642152#M77603</link>
      <description>&lt;P&gt;I don't understand how LOOKUPVALUE would help.&amp;nbsp; I already have both fields on my report.&amp;nbsp; I just want to compare the two fields and, if they are the same, leave the new column blank.&amp;nbsp; If they are different, populate the new column.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jul 2022 20:24:48 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Compare-two-fields-to-populate-a-new-column/m-p/2642152#M77603</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-07-15T20:24:48Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two fields to populate a new column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Compare-two-fields-to-populate-a-new-column/m-p/2642219#M77609</link>
      <description>&lt;P&gt;Measure:&lt;/P&gt;&lt;P&gt;isSame =&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;IF&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;MAX&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;TableName[User]&lt;/SPAN&gt;&lt;SPAN&gt;)=&lt;/SPAN&gt;&lt;SPAN&gt;MAX&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;TableName[CreateByUser]&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;SPAN&gt;"YES"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;"NO"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 15 Jul 2022 21:52:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Compare-two-fields-to-populate-a-new-column/m-p/2642219#M77609</guid>
      <dc:creator>vapid128</dc:creator>
      <dc:date>2022-07-15T21:52:04Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two fields to populate a new column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Compare-two-fields-to-populate-a-new-column/m-p/2642361#M77626</link>
      <description>&lt;P&gt;I had hopes with the MAX function!&amp;nbsp; but everything is coming up "NO":&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;I did a merge of queries to get my two "user" fields into the same table.&amp;nbsp; In the end, I actually want to put the contents of a field from another table (comments) into my new column, rather than yes/no, based on whether the two users are the same.&lt;/P&gt;</description>
      <pubDate>Sat, 16 Jul 2022 01:59:27 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Compare-two-fields-to-populate-a-new-column/m-p/2642361#M77626</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-07-16T01:59:27Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two fields to populate a new column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Compare-two-fields-to-populate-a-new-column/m-p/2642362#M77627</link>
      <description>&lt;P&gt;If those 2 are measures, try if(measure1=measure2)&lt;/P&gt;&lt;P&gt;Without max function.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Jul 2022 02:13:27 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Compare-two-fields-to-populate-a-new-column/m-p/2642362#M77627</guid>
      <dc:creator>vapid128</dc:creator>
      <dc:date>2022-07-16T02:13:27Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two fields to populate a new column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Compare-two-fields-to-populate-a-new-column/m-p/2645764#M77832</link>
      <description>&lt;P&gt;I very much appreciate the assistance from users on this forum!&amp;nbsp; I found that the solution for my situation was that I needed to do more in Power Query, rather than expecting to do column comparisons in the service.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I first did a 'merge queries', bringing the two userid fields into one merged table.&amp;nbsp; From there, I added a custom column using an IF statement, populating my new column with data from the existing 'comments' column only if the two userIDs were different.&amp;nbsp; If they were the same, I put "remove" into the new column, instead of the comments.&amp;nbsp; Then, in a next step, I filtered rows and removed all rows containing the string "remove".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've got to remember that Power Query is where all the action is.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 18 Jul 2022 19:34:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Compare-two-fields-to-populate-a-new-column/m-p/2645764#M77832</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-07-18T19:34:34Z</dc:date>
    </item>
  </channel>
</rss>

