<?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: DAX to Lookup Values in Another Column and Subtract to Achieve Remaining Columns in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-to-Lookup-Values-in-Another-Column-and-Subtract-to-Achieve/m-p/3246765#M119628</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="558906" data-lia-user-login="powerbiuser1000" class="lia-mention lia-mention-user"&gt;powerbiuser1000&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;&lt;BR /&gt;Dax's text functions are not very good at solving such problems.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Remaining Sites = 
VAR _TEXT = 
SUBSTITUTE (
    [Sites],
    CONCATENATEX (
        FILTER ( ALL ( 'Table' ), 'Table'[Ship] = EARLIER ( 'Table'[Ship] ) ),
        'Table'[Area],
        ","
    ),
    ""
)
VAR _RESULT = 
SWITCH(
    TRUE(),
    LEFT(_TEXT,1)=",",MID(_TEXT,2,LEN(_TEXT)-1),
    RIGHT(_TEXT,1)=",",MID(_TEXT,2,LEN(_TEXT)-1)
)
RETURN
_RESULT&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;This may only be appropriate for sample data. I'm guessing that [Sites] and [Areas] are probably calculated columns, so please consider refactoring them in the PowerQuery Editor to make the question much simpler.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="2"&gt;Best Regards,&lt;BR /&gt;Gao&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;Community Support Team&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="2"&gt;If there is any post&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;FONT size="3" color="#008080"&gt;&lt;EM&gt;&lt;STRONG&gt;helps&lt;/STRONG&gt;&lt;/EM&gt;&lt;/FONT&gt;, then please consider&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;FONT size="3"&gt;&lt;FONT color="#008080"&gt;&lt;EM&gt;&lt;STRONG&gt;Accept it as the solution&lt;/STRONG&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/FONT&gt;to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know.&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;FONT color="#008080"&gt;&lt;EM&gt;&lt;STRONG&gt;&lt;FONT size="3"&gt;Thanks a lot!&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="2" color="#FF0000"&gt;&lt;A href="https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490" target="_blank" rel="noopener"&gt;&lt;SPAN&gt;How to get your questions answered quickly&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;--&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216" target="_blank" rel="noopener"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;How to provide sample data in the Power BI Forum&lt;/A&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 22 May 2023 07:42:24 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2023-05-22T07:42:24Z</dc:date>
    <item>
      <title>DAX to Lookup Values in Another Column and Subtract to Achieve Remaining Columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-to-Lookup-Values-in-Another-Column-and-Subtract-to-Achieve/m-p/3230267#M118501</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hoping you you may be able to assist with my questions/challenge.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the below table and am wanting to achieve the output of the Column named "Remaining Sites"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Current :&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Hoping to create a&amp;nbsp;Column named "Remaining Sites" :&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The unique combination of values are &lt;STRONG&gt;Ship&lt;/STRONG&gt;, &lt;STRONG&gt;Ship Type&lt;/STRONG&gt;, &lt;STRONG&gt;Ship&lt;/STRONG&gt; &lt;STRONG&gt;Style&lt;/STRONG&gt; and &lt;STRONG&gt;Sites&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So for each combination of Ship, Ship Type, Ship Style and Sites there are areas which get enetered in.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am looking to have a column called "Remaining Sites" which looks up the value of 'Sites' and removes the 'Areas'.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Using the first 2 rows as an example, the Sites are: BB,EE,FF and I am needing to take away the areas for that&amp;nbsp;Ship, Ship Type, Ship Style which are BB and EE. This would leave the column with FF.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried to use a Matrix and then use LOOKUP VALUE which any luck. Have also tried to use the FIND and SEARCH functions but haven't got anywhere as of yet.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Apprecaite any help or guidance.&lt;/P&gt;</description>
      <pubDate>Thu, 11 May 2023 08:17:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-to-Lookup-Values-in-Another-Column-and-Subtract-to-Achieve/m-p/3230267#M118501</guid>
      <dc:creator>powerbiuser1000</dc:creator>
      <dc:date>2023-05-11T08:17:22Z</dc:date>
    </item>
    <item>
      <title>Re: DAX to Lookup Values in Another Column and Subtract to Achieve Remaining Columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-to-Lookup-Values-in-Another-Column-and-Subtract-to-Achieve/m-p/3234472#M118833</link>
      <description>&lt;P&gt;Use EXCEPT for that, or NOT IN { }.&lt;/P&gt;</description>
      <pubDate>Mon, 15 May 2023 00:52:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-to-Lookup-Values-in-Another-Column-and-Subtract-to-Achieve/m-p/3234472#M118833</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2023-05-15T00:52:30Z</dc:date>
    </item>
    <item>
      <title>Re: DAX to Lookup Values in Another Column and Subtract to Achieve Remaining Columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-to-Lookup-Values-in-Another-Column-and-Subtract-to-Achieve/m-p/3234480#M118834</link>
      <description>&lt;P&gt;Hi Ibendlin, thank you for that. However for Ship 1, it needs to lookup the 'area' for both the 1st and 2nd row and then use&amp;nbsp;&lt;SPAN&gt;NOT IN { }.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;For example, the 1st row needs to consider the 2nd row. And the 2nd row needs to consider the first. So need to add BB and EE and then subtract from 'Sites':&lt;BR /&gt;&lt;BR /&gt;So BB, EE NOT IN {'Sites'), so the result can be FF as shown in the second table above.&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 15 May 2023 01:06:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-to-Lookup-Values-in-Another-Column-and-Subtract-to-Achieve/m-p/3234480#M118834</guid>
      <dc:creator>powerbiuser1000</dc:creator>
      <dc:date>2023-05-15T01:06:47Z</dc:date>
    </item>
    <item>
      <title>Re: DAX to Lookup Values in Another Column and Subtract to Achieve Remaining Columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-to-Lookup-Values-in-Another-Column-and-Subtract-to-Achieve/m-p/3234492#M118835</link>
      <description>&lt;P&gt;Yes, I assumed you know how to handle filter context.&lt;/P&gt;</description>
      <pubDate>Mon, 15 May 2023 01:26:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-to-Lookup-Values-in-Another-Column-and-Subtract-to-Achieve/m-p/3234492#M118835</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2023-05-15T01:26:12Z</dc:date>
    </item>
    <item>
      <title>Re: DAX to Lookup Values in Another Column and Subtract to Achieve Remaining Columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-to-Lookup-Values-in-Another-Column-and-Subtract-to-Achieve/m-p/3234495#M118836</link>
      <description>&lt;P&gt;Hi Ibendlin, Thank you for your reply. I am not exactly sure how to do that. Are you able to clarify? thank you.&lt;/P&gt;</description>
      <pubDate>Mon, 15 May 2023 01:28:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-to-Lookup-Values-in-Another-Column-and-Subtract-to-Achieve/m-p/3234495#M118836</guid>
      <dc:creator>powerbiuser1000</dc:creator>
      <dc:date>2023-05-15T01:28:53Z</dc:date>
    </item>
    <item>
      <title>Re: DAX to Lookup Values in Another Column and Subtract to Achieve Remaining Columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-to-Lookup-Values-in-Another-Column-and-Subtract-to-Achieve/m-p/3246765#M119628</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="558906" data-lia-user-login="powerbiuser1000" class="lia-mention lia-mention-user"&gt;powerbiuser1000&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;&lt;BR /&gt;Dax's text functions are not very good at solving such problems.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Remaining Sites = 
VAR _TEXT = 
SUBSTITUTE (
    [Sites],
    CONCATENATEX (
        FILTER ( ALL ( 'Table' ), 'Table'[Ship] = EARLIER ( 'Table'[Ship] ) ),
        'Table'[Area],
        ","
    ),
    ""
)
VAR _RESULT = 
SWITCH(
    TRUE(),
    LEFT(_TEXT,1)=",",MID(_TEXT,2,LEN(_TEXT)-1),
    RIGHT(_TEXT,1)=",",MID(_TEXT,2,LEN(_TEXT)-1)
)
RETURN
_RESULT&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;This may only be appropriate for sample data. I'm guessing that [Sites] and [Areas] are probably calculated columns, so please consider refactoring them in the PowerQuery Editor to make the question much simpler.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="2"&gt;Best Regards,&lt;BR /&gt;Gao&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;Community Support Team&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="2"&gt;If there is any post&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;FONT size="3" color="#008080"&gt;&lt;EM&gt;&lt;STRONG&gt;helps&lt;/STRONG&gt;&lt;/EM&gt;&lt;/FONT&gt;, then please consider&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;FONT size="3"&gt;&lt;FONT color="#008080"&gt;&lt;EM&gt;&lt;STRONG&gt;Accept it as the solution&lt;/STRONG&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/FONT&gt;to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know.&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;FONT color="#008080"&gt;&lt;EM&gt;&lt;STRONG&gt;&lt;FONT size="3"&gt;Thanks a lot!&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="2" color="#FF0000"&gt;&lt;A href="https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490" target="_blank" rel="noopener"&gt;&lt;SPAN&gt;How to get your questions answered quickly&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;--&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216" target="_blank" rel="noopener"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;How to provide sample data in the Power BI Forum&lt;/A&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 22 May 2023 07:42:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-to-Lookup-Values-in-Another-Column-and-Subtract-to-Achieve/m-p/3246765#M119628</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-05-22T07:42:24Z</dc:date>
    </item>
    <item>
      <title>Re: DAX to Lookup Values in Another Column and Subtract to Achieve Remaining Columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-to-Lookup-Values-in-Another-Column-and-Subtract-to-Achieve/m-p/3246804#M119635</link>
      <description>&lt;P&gt;Thank you, this is exactly what I am after! Cheers&lt;/P&gt;</description>
      <pubDate>Mon, 22 May 2023 07:53:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-to-Lookup-Values-in-Another-Column-and-Subtract-to-Achieve/m-p/3246804#M119635</guid>
      <dc:creator>powerbiuser1000</dc:creator>
      <dc:date>2023-05-22T07:53:19Z</dc:date>
    </item>
  </channel>
</rss>

