<?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: Using inscope and filtering rows in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-inscope-and-filtering-rows/m-p/4146761#M164778</link>
    <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="803517" data-lia-user-login="Silvard" class="lia-mention lia-mention-user"&gt;Silvard&lt;/a&gt;&amp;nbsp;, Try using below measure&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;DistinctCountByHierarchy =&lt;BR /&gt;VAR IsAtLowestLevel = ISINSCOPE('Table'[HierarchyColumn])&lt;BR /&gt;VAR TargetHierarchyValues = {10, 11, 12, 13, 14, 15}&lt;BR /&gt;VAR IsTargetHierarchyInScope = IF(&lt;BR /&gt;IsAtLowestLevel,&lt;BR /&gt;COUNTROWS(&lt;BR /&gt;FILTER(&lt;BR /&gt;ALL('Table'),&lt;BR /&gt;'Table'[HierarchyColumn] IN TargetHierarchyValues&lt;BR /&gt;)&lt;BR /&gt;) &amp;gt; 0,&lt;BR /&gt;FALSE&lt;BR /&gt;)&lt;BR /&gt;RETURN&lt;BR /&gt;IF(&lt;BR /&gt;IsAtLowestLevel,&lt;BR /&gt;IF(&lt;BR /&gt;IsTargetHierarchyInScope,&lt;BR /&gt;CALCULATE(&lt;BR /&gt;DISTINCTCOUNT('Table'[ApplicationID]),&lt;BR /&gt;'Table'[HierarchyColumn] IN TargetHierarchyValues&lt;BR /&gt;),&lt;BR /&gt;DISTINCTCOUNT('Table'[JobID])&lt;BR /&gt;),&lt;BR /&gt;DISTINCTCOUNT('Table'[JobID])&lt;BR /&gt;)&lt;/P&gt;</description>
    <pubDate>Thu, 12 Sep 2024 09:04:23 GMT</pubDate>
    <dc:creator>bhanu_gautam</dc:creator>
    <dc:date>2024-09-12T09:04:23Z</dc:date>
    <item>
      <title>Using inscope and filtering rows</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-inscope-and-filtering-rows/m-p/4146743#M164777</link>
      <description>&lt;P&gt;I'm trying to create a measure that can be used in a graph (x-axis) where the y-axis consists of three levels of hierarchy.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;At the two top levels I'd like to use distinctcount for JobID (key) for all rows, but at the lowest levels, I'd like to use distinctcount for ApplicationID (key) for some rows and for the rest JobID.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried below, but it only seems to be using JobID.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your help is much appreciated!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;DistinctCountByHierarchy =&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;VAR IsAtLowestLevel = ISINSCOPE('Table'[HierarchyColumn]) &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;VAR = TargetHierarchyValues = {10, 11, 12, 13, 14, 15} &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;VAR IsTargetHierarchyInScope = IF( IsAtLowestLevel, COUNTROWS( FILTER( ALL('Table'), 'Table'[HierarchyColumn] IN TargetHierarchyValues ) ) &amp;gt; 0, FALSE ) &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;RETURN &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;IF( IsTargetHierarchyInScope, CALCULATE( DISTINCTCOUNT('Table'[ApplicationID]), 'Table'[HierarchyColumn] IN TargetHierarchyValues ), DISTINCTCOUNT('Table'[JobID]) )&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Sep 2024 08:55:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-inscope-and-filtering-rows/m-p/4146743#M164777</guid>
      <dc:creator>Silvard</dc:creator>
      <dc:date>2024-09-12T08:55:46Z</dc:date>
    </item>
    <item>
      <title>Re: Using inscope and filtering rows</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-inscope-and-filtering-rows/m-p/4146761#M164778</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="803517" data-lia-user-login="Silvard" class="lia-mention lia-mention-user"&gt;Silvard&lt;/a&gt;&amp;nbsp;, Try using below measure&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;DistinctCountByHierarchy =&lt;BR /&gt;VAR IsAtLowestLevel = ISINSCOPE('Table'[HierarchyColumn])&lt;BR /&gt;VAR TargetHierarchyValues = {10, 11, 12, 13, 14, 15}&lt;BR /&gt;VAR IsTargetHierarchyInScope = IF(&lt;BR /&gt;IsAtLowestLevel,&lt;BR /&gt;COUNTROWS(&lt;BR /&gt;FILTER(&lt;BR /&gt;ALL('Table'),&lt;BR /&gt;'Table'[HierarchyColumn] IN TargetHierarchyValues&lt;BR /&gt;)&lt;BR /&gt;) &amp;gt; 0,&lt;BR /&gt;FALSE&lt;BR /&gt;)&lt;BR /&gt;RETURN&lt;BR /&gt;IF(&lt;BR /&gt;IsAtLowestLevel,&lt;BR /&gt;IF(&lt;BR /&gt;IsTargetHierarchyInScope,&lt;BR /&gt;CALCULATE(&lt;BR /&gt;DISTINCTCOUNT('Table'[ApplicationID]),&lt;BR /&gt;'Table'[HierarchyColumn] IN TargetHierarchyValues&lt;BR /&gt;),&lt;BR /&gt;DISTINCTCOUNT('Table'[JobID])&lt;BR /&gt;),&lt;BR /&gt;DISTINCTCOUNT('Table'[JobID])&lt;BR /&gt;)&lt;/P&gt;</description>
      <pubDate>Thu, 12 Sep 2024 09:04:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-inscope-and-filtering-rows/m-p/4146761#M164778</guid>
      <dc:creator>bhanu_gautam</dc:creator>
      <dc:date>2024-09-12T09:04:23Z</dc:date>
    </item>
    <item>
      <title>Re: Using inscope and filtering rows</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-inscope-and-filtering-rows/m-p/4146791#M164780</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&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;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks so much for asssiting but unfortunately it produces the same result.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;have you got any other suggestions or perhaps we need to be using another method?&lt;/P&gt;</description>
      <pubDate>Thu, 12 Sep 2024 09:20:37 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Using-inscope-and-filtering-rows/m-p/4146791#M164780</guid>
      <dc:creator>Silvard</dc:creator>
      <dc:date>2024-09-12T09:20:37Z</dc:date>
    </item>
  </channel>
</rss>

