<?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: Only calculate measure where rows meet specific condition in another column in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Only-calculate-measure-where-rows-meet-specific-condition-in/m-p/3716200#M144639</link>
    <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="632282" data-lia-user-login="JadeM" class="lia-mention lia-mention-user"&gt;JadeM&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;1.The measure can be modified to:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;New Column =

  var thisName = SELECTEDVALUE('Table'[Name])

  var nameCount = COUNTROWS(FILTER(ALLSELECTED('Table'), [Name] = thisName))

  var result =

  IF(SELECTEDVALUE('Table'[Department]) = "Marketing" || SELECTEDVALUE('Table'[Department]) = "Sales",

  IF(nameCount &amp;gt; 1, "In", "Out"),BLANK())

  return IF(ISINSCOPE('Table'[Name]), result)&lt;/LI-CODE&gt;
&lt;P&gt;2.Set the Name or Department field to show items with no data so that when there is no data in the New Column column, the other columns can still be displayed normally.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The results obtained are shown below:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;If your Current Period does not refer to this, please clarify in a follow-up reply.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Clara Gong&lt;/P&gt;
&lt;P&gt;If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.&lt;/P&gt;</description>
    <pubDate>Thu, 22 Feb 2024 07:02:26 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2024-02-22T07:02:26Z</dc:date>
    <item>
      <title>Only calculate measure where rows meet specific condition in another column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Only-calculate-measure-where-rows-meet-specific-condition-in/m-p/3714554#M144560</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the below measure which I am using to calculate whether staff movement is 'In' or 'Out'. It should show 'In' where there are two instatnces of one name in the filter view and 'Out' if a name only appears once. This measure needs to be dynamic so that the value of 'In' or 'Out' changes depending on the filters applied.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The below works correctly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;New Column = 
  var thisName = SELECTEDVALUE(Table1[Name])
  var nameCount = COUNTROWS(FILTER(ALLSELECTED(Table1), [Name] = thisName))
  var result = IF(nameCount &amp;gt; 1, "In", "Out")
  return IF(ISINSCOPE('Table1'[Name]), result)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would now like to edit this measure so that the calculation only spits out 'In' or 'Out' where the value in the column 'Department' is 'Sales' or 'Marketing'. All otehr departments should be blank.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is an example of my data:&lt;/P&gt;&lt;P&gt;Table1 (no filters) John shows as 'In' in the new column as his name appears twice.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class=""&gt;Name Department New Column &lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;John&lt;/TD&gt;&lt;TD&gt;Sales&lt;/TD&gt;&lt;TD&gt;In&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;John&lt;/TD&gt;&lt;TD&gt;Marketing&lt;/TD&gt;&lt;TD&gt;In&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Julie&lt;/TD&gt;&lt;TD&gt;Marketing&lt;/TD&gt;&lt;TD&gt;Out&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Jake&lt;/TD&gt;&lt;TD&gt;Sales&lt;/TD&gt;&lt;TD&gt;Out&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Simon&lt;/TD&gt;&lt;TD&gt;IT&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;P&gt;If you then filter Department to show just Marketing (using a slicer on the same page), I would like John to change to 'Out' as there is now only one occurrence of the name John.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class=""&gt;Name Department New Column &lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;John&lt;/TD&gt;&lt;TD&gt;Marketing&lt;/TD&gt;&lt;TD&gt;Out&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Julie&lt;/TD&gt;&lt;TD&gt;Marketing&lt;/TD&gt;&lt;TD&gt;Out&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;I do &lt;STRONG&gt;not&lt;/STRONG&gt; want there to be a value next to Simon in IT as he is not in Marketing or Sales - how can I update the measure to incorporate this second requirement?&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;Thanks in advance.&lt;/DIV&gt;</description>
      <pubDate>Wed, 21 Feb 2024 14:46:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Only-calculate-measure-where-rows-meet-specific-condition-in/m-p/3714554#M144560</guid>
      <dc:creator>JadeM</dc:creator>
      <dc:date>2024-02-21T14:46:24Z</dc:date>
    </item>
    <item>
      <title>Re: Only calculate measure where rows meet specific condition in another column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Only-calculate-measure-where-rows-meet-specific-condition-in/m-p/3714633#M144563</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="632282" data-lia-user-login="JadeM" class="lia-mention lia-mention-user"&gt;JadeM&lt;/a&gt;&amp;nbsp;Maybe:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;New Column = 
  var thisName = SELECTEDVALUE(Table1[Name])
  var thisDept = SELECTEDVALUE(Table1[Department])
  var nameCount = COUNTROWS(FILTER(ALLSELECTED(Table1), [Name] = thisName))
  var result = SWITCH(TRUE(), thisDept = BLANK(), BLANK(), nameCount &amp;gt; 1, "In", "Out")
  return IF(ISINSCOPE('Table1'[Name]), result)&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 21 Feb 2024 15:07:01 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Only-calculate-measure-where-rows-meet-specific-condition-in/m-p/3714633#M144563</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2024-02-21T15:07:01Z</dc:date>
    </item>
    <item>
      <title>Re: Only calculate measure where rows meet specific condition in another column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Only-calculate-measure-where-rows-meet-specific-condition-in/m-p/3716200#M144639</link>
      <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="632282" data-lia-user-login="JadeM" class="lia-mention lia-mention-user"&gt;JadeM&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;1.The measure can be modified to:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;New Column =

  var thisName = SELECTEDVALUE('Table'[Name])

  var nameCount = COUNTROWS(FILTER(ALLSELECTED('Table'), [Name] = thisName))

  var result =

  IF(SELECTEDVALUE('Table'[Department]) = "Marketing" || SELECTEDVALUE('Table'[Department]) = "Sales",

  IF(nameCount &amp;gt; 1, "In", "Out"),BLANK())

  return IF(ISINSCOPE('Table'[Name]), result)&lt;/LI-CODE&gt;
&lt;P&gt;2.Set the Name or Department field to show items with no data so that when there is no data in the New Column column, the other columns can still be displayed normally.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The results obtained are shown below:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;If your Current Period does not refer to this, please clarify in a follow-up reply.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Clara Gong&lt;/P&gt;
&lt;P&gt;If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Thu, 22 Feb 2024 07:02:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Only-calculate-measure-where-rows-meet-specific-condition-in/m-p/3716200#M144639</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-02-22T07:02:26Z</dc:date>
    </item>
  </channel>
</rss>

