<?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 Writing a conditional column from another column in another table in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Writing-a-conditional-column-from-another-column-in-another/m-p/4037126#M160027</link>
    <description>&lt;P class=""&gt;&lt;SPAN&gt;Table 1 has a column: [region = "3300" as text]&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN&gt;Table 2 has a column [station = "3300 - Southwest Office"]&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN&gt;Essentially, I need to lookup values from table 2's "station" column using table 1's "regions" value of a 4 digit string. Since there should be an exact match in the first four characters of station I should be able to do this in a conditional column add (I think). Then I need to create a new column in table 1 that returns the full value of "station" from table 2 given the match. &lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN&gt;Not sure how to do this in the query editor since there are no relationships between these two tables. &lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 11 Jul 2024 12:22:10 GMT</pubDate>
    <dc:creator>msupg21</dc:creator>
    <dc:date>2024-07-11T12:22:10Z</dc:date>
    <item>
      <title>Writing a conditional column from another column in another table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Writing-a-conditional-column-from-another-column-in-another/m-p/4037126#M160027</link>
      <description>&lt;P class=""&gt;&lt;SPAN&gt;Table 1 has a column: [region = "3300" as text]&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN&gt;Table 2 has a column [station = "3300 - Southwest Office"]&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN&gt;Essentially, I need to lookup values from table 2's "station" column using table 1's "regions" value of a 4 digit string. Since there should be an exact match in the first four characters of station I should be able to do this in a conditional column add (I think). Then I need to create a new column in table 1 that returns the full value of "station" from table 2 given the match. &lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN&gt;Not sure how to do this in the query editor since there are no relationships between these two tables. &lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jul 2024 12:22:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Writing-a-conditional-column-from-another-column-in-another/m-p/4037126#M160027</guid>
      <dc:creator>msupg21</dc:creator>
      <dc:date>2024-07-11T12:22:10Z</dc:date>
    </item>
    <item>
      <title>Re: Writing a conditional column from another column in another table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Writing-a-conditional-column-from-another-column-in-another/m-p/4038478#M160101</link>
      <description>&lt;P&gt;HI,&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="773890" data-lia-user-login="msupg21" class="lia-mention lia-mention-user"&gt;msupg21&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;Regarding the issue you raised, my solution is as follows:&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;1.First I have created the following table and the column names and data are the data you have given:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P style="margin: 0in;"&gt;&lt;SPAN&gt;2.&lt;/SPAN&gt;&lt;SPAN&gt;Then station&lt;/SPAN&gt; &lt;SPAN&gt;table &lt;/SPAN&gt;&lt;SPAN&gt;add custom columns in PowerQuery:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Text.Start([station],4)&lt;/LI-CODE&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 11.0pt;"&gt;&lt;SPAN&gt;3.&lt;/SPAN&gt;&lt;SPAN&gt;Finally, use the merge query in the region table to expand:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;" lang="zh-CN"&gt;4.Here are my end results, I hope to meet your needs:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;" lang="zh-CN"&gt;Note that the data types of the columns are consistent when merging queries.&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;" lang="zh-CN"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;Please find the attached pbix relevant to the case.&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;Best Regards,&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;Leroy Lu&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;If this post &lt;SPAN&gt;helps&lt;/SPAN&gt;, then please consider Accept it &lt;SPAN&gt;as the solution &lt;/SPAN&gt;to help the other members find it more quickly.&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;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jul 2024 03:36:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Writing-a-conditional-column-from-another-column-in-another/m-p/4038478#M160101</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-07-12T03:36:06Z</dc:date>
    </item>
  </channel>
</rss>

