<?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 Dax - Ignores filter Condition in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-Ignores-filter-Condition/m-p/3693772#M143601</link>
    <description>&lt;P&gt;I have a piece of code in DAX that "works" perfectly. However if I add an extra filter inito the code, then it goes a bit pear shaped. For the life of me I ave tried to fix this and failed miserably. Any suggestions welcome &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;The code below. This works perfect - counting staff at month end each month. BUT, only if no slicers are active to filter "Business Area".&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;EmployeesAtEndOfMonth = 
IF(
    ISFILTERED('staffmaster'[Business Area]), 
    CALCULATE(
        DISTINCTCOUNT('staffmaster'[Unique ID]),
        FILTER(
            ALL('staffmaster'),
            'staffmaster'[Business Area] IN VALUES ('STAFFMASTER'[Business Area]) &amp;amp;&amp;amp;
            ('staffmaster'[End Date] &amp;gt;= MAX('Date'[End of Month]) || ISBLANK('staffmaster'[End Date])) &amp;amp;&amp;amp;
            'staffmaster'[Start Date] &amp;lt;= MAX('Date'[End of Month]) 
            
        )
    ),
    CALCULATE(
        DISTINCTCOUNT('staffmaster'[Unique ID]),
        FILTER(
            ALL('staffmaster'),
            ('staffmaster'[End Date] &amp;gt;= MAX('Date'[End of Month]) || ISBLANK('staffmaster'[End Date])) &amp;amp;&amp;amp;
            'staffmaster'[Start Date] &amp;lt;= MAX('Date'[End of Month])
        )
    )
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I select a "Business Area" in a slicer.&amp;nbsp; Lets for example say "HR", then I get some odd behavour. If the month in question did not have someone new starting that month, it doesnt count anything for that month.&lt;BR /&gt;&lt;BR /&gt;Example -&amp;nbsp;&lt;BR /&gt;Jan23 - 30 staff (Powerbi counts 30 staff because someone new started month)&lt;/P&gt;&lt;P&gt;Feb 23 - 37 staff (because at least one new start that month)&lt;BR /&gt;Mar23 - 0 staff (no new starts this month so powerbi just counts the month as blank)&lt;/P&gt;&lt;P&gt;April 23 - 35 staff (at least one new start)&lt;/P&gt;&lt;P&gt;May23 - 0 staff (no new starts this month)&lt;/P&gt;&lt;P&gt;Jun23 - 36 staff (at least one new start)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So the only correlation between the blanks is that we had no new starts in "HR" in the blank months. I have check against other Business Areas and the correlation seems to hold up. ANy business area where we had a least one new start each month, has no blanks. Any business area where we had no new starts in any month, those months show a blank.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Im no PBI master and I expect the answer is simple enough, but im stumped.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As for data tables the data comes from:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Date Table - marked as date table, called "Date". Has columns for [Date], [End of Month]&lt;BR /&gt;&lt;BR /&gt;Staff table - called Staffmaster. Has columns for [Unique ID], [Start Date], [End Date], [Business Area].&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;All i want to do is show a number of staff employed on the last day of each month, and be able to filter it by business area.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 12 Feb 2024 10:01:05 GMT</pubDate>
    <dc:creator>DH3612</dc:creator>
    <dc:date>2024-02-12T10:01:05Z</dc:date>
    <item>
      <title>Dax - Ignores filter Condition</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-Ignores-filter-Condition/m-p/3693772#M143601</link>
      <description>&lt;P&gt;I have a piece of code in DAX that "works" perfectly. However if I add an extra filter inito the code, then it goes a bit pear shaped. For the life of me I ave tried to fix this and failed miserably. Any suggestions welcome &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;The code below. This works perfect - counting staff at month end each month. BUT, only if no slicers are active to filter "Business Area".&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;EmployeesAtEndOfMonth = 
IF(
    ISFILTERED('staffmaster'[Business Area]), 
    CALCULATE(
        DISTINCTCOUNT('staffmaster'[Unique ID]),
        FILTER(
            ALL('staffmaster'),
            'staffmaster'[Business Area] IN VALUES ('STAFFMASTER'[Business Area]) &amp;amp;&amp;amp;
            ('staffmaster'[End Date] &amp;gt;= MAX('Date'[End of Month]) || ISBLANK('staffmaster'[End Date])) &amp;amp;&amp;amp;
            'staffmaster'[Start Date] &amp;lt;= MAX('Date'[End of Month]) 
            
        )
    ),
    CALCULATE(
        DISTINCTCOUNT('staffmaster'[Unique ID]),
        FILTER(
            ALL('staffmaster'),
            ('staffmaster'[End Date] &amp;gt;= MAX('Date'[End of Month]) || ISBLANK('staffmaster'[End Date])) &amp;amp;&amp;amp;
            'staffmaster'[Start Date] &amp;lt;= MAX('Date'[End of Month])
        )
    )
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I select a "Business Area" in a slicer.&amp;nbsp; Lets for example say "HR", then I get some odd behavour. If the month in question did not have someone new starting that month, it doesnt count anything for that month.&lt;BR /&gt;&lt;BR /&gt;Example -&amp;nbsp;&lt;BR /&gt;Jan23 - 30 staff (Powerbi counts 30 staff because someone new started month)&lt;/P&gt;&lt;P&gt;Feb 23 - 37 staff (because at least one new start that month)&lt;BR /&gt;Mar23 - 0 staff (no new starts this month so powerbi just counts the month as blank)&lt;/P&gt;&lt;P&gt;April 23 - 35 staff (at least one new start)&lt;/P&gt;&lt;P&gt;May23 - 0 staff (no new starts this month)&lt;/P&gt;&lt;P&gt;Jun23 - 36 staff (at least one new start)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So the only correlation between the blanks is that we had no new starts in "HR" in the blank months. I have check against other Business Areas and the correlation seems to hold up. ANy business area where we had a least one new start each month, has no blanks. Any business area where we had no new starts in any month, those months show a blank.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Im no PBI master and I expect the answer is simple enough, but im stumped.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As for data tables the data comes from:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Date Table - marked as date table, called "Date". Has columns for [Date], [End of Month]&lt;BR /&gt;&lt;BR /&gt;Staff table - called Staffmaster. Has columns for [Unique ID], [Start Date], [End Date], [Business Area].&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;All i want to do is show a number of staff employed on the last day of each month, and be able to filter it by business area.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Feb 2024 10:01:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-Ignores-filter-Condition/m-p/3693772#M143601</guid>
      <dc:creator>DH3612</dc:creator>
      <dc:date>2024-02-12T10:01:05Z</dc:date>
    </item>
    <item>
      <title>Re: Dax - Ignores filter Condition</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-Ignores-filter-Condition/m-p/3694473#M143648</link>
      <description>&lt;P&gt;OK, I have no idea why it was counting that way. And I have rewritten the entire piece to use&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="148838" data-lia-user-login="amitchandak" class="lia-mention lia-mention-user"&gt;amitchandak&lt;/a&gt;&amp;nbsp;code from his youtube page. It works perfect under all tests now.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://www.youtube.com/watch?v=e6Y-l_JtCq4" target="_blank" rel="noopener"&gt;Amits Youtube Linky&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Feb 2024 16:12:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-Ignores-filter-Condition/m-p/3694473#M143648</guid>
      <dc:creator>DH3612</dc:creator>
      <dc:date>2024-02-12T16:12:15Z</dc:date>
    </item>
  </channel>
</rss>

