<?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: Return a Value based on Text Column in another Table in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Return-a-Value-based-on-Text-Column-in-another-Table/m-p/4390705#M174310</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="922768" data-lia-user-login="303" class="lia-mention lia-mention-user"&gt;303&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To achieve the desired outcome where only the specific sport (e.g., "Football") appears for each name, and others show as blank if they don't match, you can approach this with &lt;STRONG&gt;measures&lt;/STRONG&gt; in Power BI. Since you're working with a semantic model and not doing merges or calculated columns, here’s how you can get the behavior you want:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Football Check = 
IF (
    COUNTROWS ( 
        FILTER (
            Sports, 
            Sports[Sport] = "Football" &amp;amp;&amp;amp; 
            Sports[Name] = MAX ( Names[Name] )
        )
    ) &amp;gt; 0, 
    "Football", 
    BLANK()
)
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;If you want to apply this logic to other sports dynamically (e.g., allow the user to choose a sport from a slicer), you can modify the measure to take the selected sport from the slicer and return the relevant sport name or blank.&lt;/LI&gt;
&lt;LI&gt;If you need this for multiple sports, you could create a similar measure for each sport or make the measure dynamic based on slicer selection.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;This should resolve the issue you're facing and give you the flexibility to show only the desired sport or a blank when there is no match.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 01 Feb 2025 06:05:54 GMT</pubDate>
    <dc:creator>Poojara_D12</dc:creator>
    <dc:date>2025-02-01T06:05:54Z</dc:date>
    <item>
      <title>Return a Value based on Text Column in another Table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Return-a-Value-based-on-Text-Column-in-another-Table/m-p/4390540#M174300</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;Can't get my head around this one, I'm working with a Semantic Model so no merges or calculated columns. Below is a simplified example. Lets say I have two tables, one called Names and one called Sports.&lt;/P&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Names&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Bob&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Rita&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Sue&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;Charlie&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Name&lt;/TD&gt;&lt;TD&gt;Sport&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Bob&lt;/TD&gt;&lt;TD&gt;Football&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Bob&lt;/TD&gt;&lt;TD&gt;Rugby&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Bob&lt;/TD&gt;&lt;TD&gt;Cricket&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Rita&lt;/TD&gt;&lt;TD&gt;Rugby&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Rita&lt;/TD&gt;&lt;TD&gt;Cricket&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Sue&lt;/TD&gt;&lt;TD&gt;Running&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Sue&lt;/TD&gt;&lt;TD&gt;Snooker&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Charlie&lt;/TD&gt;&lt;TD&gt;Football&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Charlie&lt;/TD&gt;&lt;TD&gt;Cricket&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I want to produce is a table(visual) like below, so if they play football the word comes up, but if they don't I just get a blank, so I can't just filter the field in the table. All I want to see is the word Football which is selected from the Sports table or a blank if there is nothing. At the moment all I get is either multiple lines with everything on or I have to filter out the ones which don't have a match. Any help greatly appreciated to get me going in the right direction.&lt;/P&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Names&lt;/TD&gt;&lt;TD&gt;Sport&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Bob&lt;/TD&gt;&lt;TD&gt;Football&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Rita&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Sue&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Charlie&lt;/TD&gt;&lt;TD&gt;Football&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Fri, 31 Jan 2025 21:46:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Return-a-Value-based-on-Text-Column-in-another-Table/m-p/4390540#M174300</guid>
      <dc:creator>303</dc:creator>
      <dc:date>2025-01-31T21:46:09Z</dc:date>
    </item>
    <item>
      <title>Re: Return a Value based on Text Column in another Table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Return-a-Value-based-on-Text-Column-in-another-Table/m-p/4390690#M174309</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="922768" data-lia-user-login="303" class="lia-mention lia-mention-user"&gt;303&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;You can achieve this in Power BI using a DAX measure that dynamically checks whether each person plays "Football" and returns the word "Football" if they do, otherwise, it returns blank. Since you're working with a Semantic Model and cannot use merges or calculated columns, the measure needs to evaluate the relationship between the two tables at runtime.&lt;/P&gt;
&lt;P&gt;A good approach is to use the CALCULATE function to filter only the "Football" rows from the Sports table. The following DAX measure does this:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;ShowFootball = 
VAR _HasFootball = 
    CALCULATE(
        SELECTEDVALUE(Sports[Sport]),
        Sports[Sport] = "Football"
    )
RETURN
    IF(NOT(ISBLANK(_HasFootball)), "Football", BLANK())
&lt;/LI-CODE&gt;
&lt;P&gt;This measure works by checking if there is a row in the Sports table where the person's sport is "Football." If such a row exists, it returns "Football"; otherwise, it returns blank. The result can be placed in a Table Visual along with the Names column to display only "Football" for those who play it.&lt;/P&gt;
&lt;P&gt;Alternatively, a more efficient way to check for the presence of "Football" is to count how many rows exist where the sport is "Football" and return "Football" only if the count is greater than zero:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;ShowFootball =
IF(
    CALCULATE(COUNTROWS(Sports), Sports[Sport] = "Football") &amp;gt; 0,
    "Football",
    BLANK()
)
&lt;/LI-CODE&gt;
&lt;P&gt;This approach ensures that the table visual remains clean, displaying "Football" only when applicable, without duplicating names or requiring any filtering.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards,&lt;/P&gt;</description>
      <pubDate>Sat, 01 Feb 2025 05:42:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Return-a-Value-based-on-Text-Column-in-another-Table/m-p/4390690#M174309</guid>
      <dc:creator>DataNinja777</dc:creator>
      <dc:date>2025-02-01T05:42:30Z</dc:date>
    </item>
    <item>
      <title>Re: Return a Value based on Text Column in another Table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Return-a-Value-based-on-Text-Column-in-another-Table/m-p/4390705#M174310</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="922768" data-lia-user-login="303" class="lia-mention lia-mention-user"&gt;303&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To achieve the desired outcome where only the specific sport (e.g., "Football") appears for each name, and others show as blank if they don't match, you can approach this with &lt;STRONG&gt;measures&lt;/STRONG&gt; in Power BI. Since you're working with a semantic model and not doing merges or calculated columns, here’s how you can get the behavior you want:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Football Check = 
IF (
    COUNTROWS ( 
        FILTER (
            Sports, 
            Sports[Sport] = "Football" &amp;amp;&amp;amp; 
            Sports[Name] = MAX ( Names[Name] )
        )
    ) &amp;gt; 0, 
    "Football", 
    BLANK()
)
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;If you want to apply this logic to other sports dynamically (e.g., allow the user to choose a sport from a slicer), you can modify the measure to take the selected sport from the slicer and return the relevant sport name or blank.&lt;/LI&gt;
&lt;LI&gt;If you need this for multiple sports, you could create a similar measure for each sport or make the measure dynamic based on slicer selection.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;This should resolve the issue you're facing and give you the flexibility to show only the desired sport or a blank when there is no match.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 01 Feb 2025 06:05:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Return-a-Value-based-on-Text-Column-in-another-Table/m-p/4390705#M174310</guid>
      <dc:creator>Poojara_D12</dc:creator>
      <dc:date>2025-02-01T06:05:54Z</dc:date>
    </item>
    <item>
      <title>Re: Return a Value based on Text Column in another Table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Return-a-Value-based-on-Text-Column-in-another-Table/m-p/4390850#M174314</link>
      <description>&lt;P&gt;&lt;FONT style="--darkreader-inline-color: var(--darkreader-text-000000, #e8e6e3);" color="#000000" data-darkreader-inline-color=""&gt;hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="922768" data-lia-user-login="303" class="lia-mention lia-mention-user"&gt;303&lt;/a&gt; ,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT style="--darkreader-inline-color: var(--darkreader-text-000000, #e8e6e3);" color="#000000" data-darkreader-inline-color=""&gt;You can achieve this in Power BI (DAX) using a calculated measure that checks whether each person has Football in the Sports table.&lt;/FONT&gt;&lt;/P&gt;
&lt;H3&gt;&lt;FONT style="--darkreader-inline-color: var(--darkreader-text-000000, #e8e6e3);" color="#000000" data-darkreader-inline-color=""&gt;DAX Measure Solution&lt;/FONT&gt;&lt;/H3&gt;
&lt;P&gt;&lt;FONT style="--darkreader-inline-color: var(--darkreader-text-000000, #e8e6e3);" color="#000000" data-darkreader-inline-color=""&gt;Since you cannot use merges or calculated columns, you need a measure to dynamically check if a person plays Football:&lt;/FONT&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Football_Sport =
VAR HasFootball = 
    CALCULATE(
        MAX(Sports[Sport]), 
        Sports[Sport] = "Football"
    )
RETURN
IF(HasFootball = "Football", "Football", BLANK())
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 01 Feb 2025 12:04:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Return-a-Value-based-on-Text-Column-in-another-Table/m-p/4390850#M174314</guid>
      <dc:creator>rohit1991</dc:creator>
      <dc:date>2025-02-01T12:04:34Z</dc:date>
    </item>
  </channel>
</rss>

