<?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: How to count values that appear in two columns of same table when selected through Slicer in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-count-values-that-appear-in-two-columns-of-same-table/m-p/4353557#M172859</link>
    <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="907940" data-lia-user-login="sdm2211" class="lia-mention lia-mention-user"&gt;sdm2211&lt;/a&gt;&amp;nbsp;- Did you try my solution? My screenshot shows it works.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Attached is the PBIX.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The reason the other measures will not work is because of your 2nd relationship. This is why my solution uses a disconnected "Team" table.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 07 Jan 2025 14:25:18 GMT</pubDate>
    <dc:creator>mark_endicott</dc:creator>
    <dc:date>2025-01-07T14:25:18Z</dc:date>
    <item>
      <title>How to count values that appear in two columns of same table when selected through Slicer</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-count-values-that-appear-in-two-columns-of-same-table/m-p/4353360#M172853</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have below table called "Matches"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Team 1&lt;/TD&gt;&lt;TD&gt;Team 2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Chennai Spure Kings&lt;/TD&gt;&lt;TD&gt;Mumbai Indians&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Delhi Capital&lt;/TD&gt;&lt;TD&gt;Rajasthan Royal&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Mumbai Indians&lt;/TD&gt;&lt;TD&gt;Delhi Capital&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Rajasthan Royal&lt;/TD&gt;&lt;TD&gt;Chennai Super Kings&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Delhi Capital&lt;/TD&gt;&lt;TD&gt;Mumbai Indians&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am adding a Slicer where there are season like 2008, 2009, 2010&lt;/P&gt;&lt;P&gt;i am adding a Slicer where there are teams like Chennai Super Kings, Mumbai Indians&lt;/P&gt;&lt;P&gt;Assume I have selected season 2010 in seasons slicer and selected Delhi Capital in team slicer then it should give the total count of matches played as 3, considering from Column Team 1 &amp;amp; Team 2.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am not able to fetch this details. Please help me&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Sandeep Marathe&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jan 2025 11:49:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-count-values-that-appear-in-two-columns-of-same-table/m-p/4353360#M172853</guid>
      <dc:creator>sdm2211</dc:creator>
      <dc:date>2025-01-07T11:49:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to count values that appear in two columns of same table when selected through Slicer</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-count-values-that-appear-in-two-columns-of-same-table/m-p/4353366#M172854</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="907940" data-lia-user-login="sdm2211" class="lia-mention lia-mention-user"&gt;sdm2211&lt;/a&gt;&amp;nbsp;,Create a new measure to count the matches played by the selected team in the selected season. Assuming you have a column named Season in your table, the DAX formula would look like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Total Matches Played = &lt;BR /&gt;VAR SelectedTeam = SELECTEDVALUE('Teams'[Team])&lt;BR /&gt;VAR SelectedSeason = SELECTEDVALUE('Seasons'[Season])&lt;BR /&gt;RETURN&lt;BR /&gt;CALCULATE(&lt;BR /&gt;COUNTROWS('Matches'),&lt;BR /&gt;FILTER(&lt;BR /&gt;'Matches',&lt;BR /&gt;('Matches'[Team 1] = SelectedTeam || 'Matches'[Team 2] = SelectedTeam) &amp;amp;&amp;amp;&lt;BR /&gt;'Matches'[Season] = SelectedSeason&lt;BR /&gt;)&lt;BR /&gt;)&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jan 2025 11:53:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-count-values-that-appear-in-two-columns-of-same-table/m-p/4353366#M172854</guid>
      <dc:creator>bhanu_gautam</dc:creator>
      <dc:date>2025-01-07T11:53:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to count values that appear in two columns of same table when selected through Slicer</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-count-values-that-appear-in-two-columns-of-same-table/m-p/4353374#M172855</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="907940" data-lia-user-login="sdm2211" class="lia-mention lia-mention-user"&gt;sdm2211&lt;/a&gt;&amp;nbsp;- I would take the following steps&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Create a disconnected "Team" table with the DAX below - to do this, go to the "Modelling" tab and select "New Table" then enter this in to the formula bar:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Team = DISTINCT(UNION( VALUES('Table'[Team 1]), VALUES( 'Table'[Team 2] )))&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You must ensure there is no releationship to your 1st table so delete this if one is created.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then you can create a DAX measure that adds the two counts from each column together, use this DAX:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;VAR selected_team =
    SELECTEDVALUE ( Team[Team 1] )
VAR count_1 =
    CALCULATE ( COUNTROWS ( 'Table' ), 'Table'[Team 1] = selected_team )
VAR count_2 =
    CALCULATE ( COUNTROWS ( 'Table' ), 'Table'[Team 2] = selected_team )
RETURN
    count_1 + count_2&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And then add the "Team 1" column from your new "Team" table to a slicer:&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;
&lt;P&gt;If this works for you, please accept it as the solution to help others with the same challenge.&amp;nbsp;&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;</description>
      <pubDate>Tue, 07 Jan 2025 12:01:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-count-values-that-appear-in-two-columns-of-same-table/m-p/4353374#M172855</guid>
      <dc:creator>mark_endicott</dc:creator>
      <dc:date>2025-01-07T12:01:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to count values that appear in two columns of same table when selected through Slicer</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-count-values-that-appear-in-two-columns-of-same-table/m-p/4353381#M172856</link>
      <description>&lt;P&gt;TotalMatchesPlayed =&lt;BR /&gt;VAR SelectedTeam = SELECTEDVALUE('Teams'[Team])&lt;BR /&gt;RETURN&lt;BR /&gt;CALCULATE(&lt;BR /&gt;COUNTROWS('Matches'),&lt;BR /&gt;FILTER(&lt;BR /&gt;'Matches',&lt;BR /&gt;'Matches'[Team 1] = SelectedTeam || 'Matches'[Team 2] = SelectedTeam&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;TotalMatchesPlayed =&lt;BR /&gt;VAR SelectedTeam = SELECTEDVALUE('Teams'[Team])&lt;BR /&gt;VAR SelectedSeason = SELECTEDVALUE('Seasons'[Season])&lt;BR /&gt;RETURN&lt;BR /&gt;CALCULATE(&lt;BR /&gt;COUNTROWS('Matches'),&lt;BR /&gt;FILTER(&lt;BR /&gt;'Matches',&lt;BR /&gt;('Matches'[Team 1] = SelectedTeam || 'Matches'[Team 2] = SelectedTeam) &amp;amp;&amp;amp;&lt;BR /&gt;'Matches'[Season] = SelectedSeason&lt;BR /&gt;)&lt;BR /&gt;)&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jan 2025 12:05:44 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-count-values-that-appear-in-two-columns-of-same-table/m-p/4353381#M172856</guid>
      <dc:creator>EricVieira</dc:creator>
      <dc:date>2025-01-07T12:05:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to count values that appear in two columns of same table when selected through Slicer</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-count-values-that-appear-in-two-columns-of-same-table/m-p/4353516#M172858</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="625922" data-lia-user-login="bhanu_gautam" class="lia-mention lia-mention-user"&gt;bhanu_gautam&lt;/a&gt;&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="511889" data-lia-user-login="EricVieira" class="lia-mention lia-mention-user"&gt;EricVieira&lt;/a&gt;&amp;nbsp;The Measure you gave is not working. I have created measure you gave but it is giving (BLANK)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;my data model is as above&lt;/P&gt;&lt;P&gt;1st Relation is from table &lt;STRONG&gt;matches - id&lt;/STRONG&gt; to table &lt;STRONG&gt;deliveries - match_id&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;2nd Relation is from Table &lt;STRONG&gt;Teams-Team Names&lt;/STRONG&gt; to table &lt;STRONG&gt;matches-team1&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jan 2025 14:05:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-count-values-that-appear-in-two-columns-of-same-table/m-p/4353516#M172858</guid>
      <dc:creator>sdm2211</dc:creator>
      <dc:date>2025-01-07T14:05:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to count values that appear in two columns of same table when selected through Slicer</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-count-values-that-appear-in-two-columns-of-same-table/m-p/4353557#M172859</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="907940" data-lia-user-login="sdm2211" class="lia-mention lia-mention-user"&gt;sdm2211&lt;/a&gt;&amp;nbsp;- Did you try my solution? My screenshot shows it works.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Attached is the PBIX.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The reason the other measures will not work is because of your 2nd relationship. This is why my solution uses a disconnected "Team" table.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jan 2025 14:25:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-count-values-that-appear-in-two-columns-of-same-table/m-p/4353557#M172859</guid>
      <dc:creator>mark_endicott</dc:creator>
      <dc:date>2025-01-07T14:25:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to count values that appear in two columns of same table when selected through Slicer</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-count-values-that-appear-in-two-columns-of-same-table/m-p/4353828#M172863</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="343036" data-lia-user-login="mark_endicott" class="lia-mention lia-mention-user"&gt;mark_endicott&lt;/a&gt;&amp;nbsp;thanks a lot for your help, It is counting as per my expectation. I just observed when in team slicer when I select "ALL", total number of matches shows as (BLANK). But if selected single value in slicer then it is showing correctly. I am trying to attached pbix file here, but not allowing&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jan 2025 17:23:02 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-count-values-that-appear-in-two-columns-of-same-table/m-p/4353828#M172863</guid>
      <dc:creator>sdm2211</dc:creator>
      <dc:date>2025-01-07T17:23:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to count values that appear in two columns of same table when selected through Slicer</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-count-values-that-appear-in-two-columns-of-same-table/m-p/4353836#M172864</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="907940" data-lia-user-login="sdm2211" class="lia-mention lia-mention-user"&gt;sdm2211&lt;/a&gt;&amp;nbsp;- You didn't specify this as a requirement, I've ammended my DAX measure below for to account for someone selecting "All" for the teams - here it will now just count the number of matches.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;VAR selected_team =
    SELECTEDVALUE ( Team[Team 1] )
VAR count_1 =
    CALCULATE ( COUNTROWS ( 'Table' ), 'Table'[Team 1] = selected_team )
VAR count_2 =
    CALCULATE ( COUNTROWS ( 'Table' ), 'Table'[Team 2] = selected_team )
RETURN
    IF ( HASONEVALUE ( Team[Team 1] ), count_1 + count_2, COUNTROWS ( 'Table' ) )&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also re-attached PBIX file.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jan 2025 17:32:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-count-values-that-appear-in-two-columns-of-same-table/m-p/4353836#M172864</guid>
      <dc:creator>mark_endicott</dc:creator>
      <dc:date>2025-01-07T17:32:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to count values that appear in two columns of same table when selected through Slicer</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-count-values-that-appear-in-two-columns-of-same-table/m-p/4353845#M172865</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="343036" data-lia-user-login="mark_endicott" class="lia-mention lia-mention-user"&gt;mark_endicott&lt;/a&gt;&amp;nbsp;You are a Magician&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":grinning_face:"&gt;😀&lt;/span&gt;. That additional line made wonders&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":grinning_face:"&gt;😀&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jan 2025 17:45:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-count-values-that-appear-in-two-columns-of-same-table/m-p/4353845#M172865</guid>
      <dc:creator>sdm2211</dc:creator>
      <dc:date>2025-01-07T17:45:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to count values that appear in two columns of same table when selected through Slicer</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-count-values-that-appear-in-two-columns-of-same-table/m-p/4353877#M172866</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="343036" data-lia-user-login="mark_endicott" class="lia-mention lia-mention-user"&gt;mark_endicott&lt;/a&gt;&lt;SPAN&gt;Great solution! I've tested it as well, and it works perfectly. &lt;span class="lia-unicode-emoji" title=":smiling_face_with_smiling_eyes:"&gt;😊&lt;/span&gt; I've also created an explanation video to help others. Thanks again!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://youtu.be/ErBA9wGYZMo" target="_blank"&gt;https://youtu.be/ErBA9wGYZMo&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jan 2025 17:56:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-count-values-that-appear-in-two-columns-of-same-table/m-p/4353877#M172866</guid>
      <dc:creator>SantoshPothnak</dc:creator>
      <dc:date>2025-01-07T17:56:20Z</dc:date>
    </item>
  </channel>
</rss>

