<?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: Page filter gets ignored in measure in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Page-filter-gets-ignored-in-measure/m-p/1116567#M16312</link>
    <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="228639" data-lia-user-login="a_gaisin" class="lia-mention lia-mention-user"&gt;a_gaisin&lt;/a&gt;&amp;nbsp; Please provide sample data and expected output&lt;/P&gt;</description>
    <pubDate>Sun, 24 May 2020 15:24:16 GMT</pubDate>
    <dc:creator>nandukrishnavs</dc:creator>
    <dc:date>2020-05-24T15:24:16Z</dc:date>
    <item>
      <title>Page filter gets ignored in measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Page-filter-gets-ignored-in-measure/m-p/1116536#M16304</link>
      <description>&lt;P class="p1"&gt;Hello, I’m quite new to Power Bi and DAX, and encountered a problem, when page filter is ignored when a measure is calculated.&lt;/P&gt;&lt;P class="p1"&gt;I have a table with project numbers, for each project there exists a certain number of entries in the table. There’s also a page filter that filters only certain subset of projects. For filtered subset of projects I need to calculate the number of entries that have their value in column called “Code” equal to “ABC”.&lt;/P&gt;&lt;P class="p1"&gt;To do it, I created the following measure:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Count ABC = CALCULATE(COUNT(Table[‘Code’]), Table[‘Code’]=“ABC”)&lt;/LI-CODE&gt;&lt;P class="p1"&gt;I also added the following measure that counts overall number of entries(with any code) for every filtered project:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Count # codes = COUNTROWS(Table)&lt;/LI-CODE&gt;&lt;P class="p1"&gt;Adding these two measures in Matrix visual gives the following result:&lt;/P&gt;&lt;P class="p1"&gt;&lt;img /&gt;&lt;/P&gt;&lt;P class="p1"&gt;Now, I’m trying to add a third measure, that is supposed to take values based on a value of Count ABC. In my case, it should be equal to 1 if value of Count ABC equals 1, and 0 otherwise.&lt;/P&gt;&lt;P class="p1"&gt;Here’s the code:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Count ABC with IF = IF(CALCULATE(COUNT(Table[‘Code’]),Table[‘Code]=“ABC”)=1,1,0)&lt;/LI-CODE&gt;&lt;P class="p1"&gt;When added to a Matrix visual (see image excerpt below), this measure completely ignores the page filter, and computes values for a set of all projects.&lt;/P&gt;&lt;P class="p1"&gt;&lt;img /&gt;&lt;/P&gt;&lt;P class="p1"&gt;How can I force it to comply with the page filter?&lt;/P&gt;&lt;P class="p1"&gt;Thank you very much for help.&lt;/P&gt;</description>
      <pubDate>Sun, 24 May 2020 14:14:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Page-filter-gets-ignored-in-measure/m-p/1116536#M16304</guid>
      <dc:creator>a_gaisin</dc:creator>
      <dc:date>2020-05-24T14:14:38Z</dc:date>
    </item>
    <item>
      <title>Re: Page filter gets ignored in measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Page-filter-gets-ignored-in-measure/m-p/1116540#M16305</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="228639" data-lia-user-login="a_gaisin" class="lia-mention lia-mention-user"&gt;a_gaisin&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Try this&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;Count ABC with IF =
VAR x =
    CALCULATE (
        COUNT ( 'Table'[Code] ),
        'Table'[Code] = "ABC"
    )
RETURN
    IF (
        x = 1,
        1,
        BLANK ()
    )&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Did I answer your question? Mark my post as a solution!&lt;BR /&gt;Appreciate with a kudos &lt;/STRONG&gt;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my latest blog&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://community.powerbi.com/t5/Community-Blog/Dynamic-Page-Navigation-Based-on-User-Login/ba-p/1097786" target="_blank"&gt;https://community.powerbi.com/t5/Community-Blog/Dynamic-Page-Navigation-Based-on-User-Login/ba-p/1097786&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 24 May 2020 14:21:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Page-filter-gets-ignored-in-measure/m-p/1116540#M16305</guid>
      <dc:creator>nandukrishnavs</dc:creator>
      <dc:date>2020-05-24T14:21:38Z</dc:date>
    </item>
    <item>
      <title>Re: Page filter gets ignored in measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Page-filter-gets-ignored-in-measure/m-p/1116548#M16306</link>
      <description>&lt;P&gt;It works with BLANK(), thank you!&lt;/P&gt;&lt;P&gt;But how to make it work if I want it to equal to 0 or any other value?&lt;/P&gt;</description>
      <pubDate>Sun, 24 May 2020 14:42:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Page-filter-gets-ignored-in-measure/m-p/1116548#M16306</guid>
      <dc:creator>a_gaisin</dc:creator>
      <dc:date>2020-05-24T14:42:10Z</dc:date>
    </item>
    <item>
      <title>Re: Page filter gets ignored in measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Page-filter-gets-ignored-in-measure/m-p/1116557#M16308</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="228639" data-lia-user-login="a_gaisin" class="lia-mention lia-mention-user"&gt;a_gaisin&lt;/a&gt;&amp;nbsp;Can you explain your latest question?&lt;/P&gt;</description>
      <pubDate>Sun, 24 May 2020 15:00:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Page-filter-gets-ignored-in-measure/m-p/1116557#M16308</guid>
      <dc:creator>nandukrishnavs</dc:creator>
      <dc:date>2020-05-24T15:00:56Z</dc:date>
    </item>
    <item>
      <title>Re: Page filter gets ignored in measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Page-filter-gets-ignored-in-measure/m-p/1116559#M16309</link>
      <description>&lt;P&gt;I want the measure equal to 0, not BLANK, in case of FALSE. How can I make it happen?&lt;/P&gt;</description>
      <pubDate>Sun, 24 May 2020 15:05:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Page-filter-gets-ignored-in-measure/m-p/1116559#M16309</guid>
      <dc:creator>a_gaisin</dc:creator>
      <dc:date>2020-05-24T15:05:15Z</dc:date>
    </item>
    <item>
      <title>Re: Page filter gets ignored in measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Page-filter-gets-ignored-in-measure/m-p/1116567#M16312</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="228639" data-lia-user-login="a_gaisin" class="lia-mention lia-mention-user"&gt;a_gaisin&lt;/a&gt;&amp;nbsp; Please provide sample data and expected output&lt;/P&gt;</description>
      <pubDate>Sun, 24 May 2020 15:24:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Page-filter-gets-ignored-in-measure/m-p/1116567#M16312</guid>
      <dc:creator>nandukrishnavs</dc:creator>
      <dc:date>2020-05-24T15:24:16Z</dc:date>
    </item>
    <item>
      <title>Re: Page filter gets ignored in measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Page-filter-gets-ignored-in-measure/m-p/1118136#M16402</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="32333" data-lia-user-login="nandukrishnavs" class="lia-mention lia-mention-user"&gt;nandukrishnavs&lt;/a&gt;&amp;nbsp;, please take a look at this pbix file (google drive)&amp;nbsp;&lt;A href="https://drive.google.com/file/d/1QawaQQncB0k6eaTUbuuF22vN8nrCyyRY/view?usp=sharing" target="_self"&gt;https://drive.google.com/file/d/1QawaQQncB0k6eaTUbuuF22vN8nrCyyRY/view?usp=sharing&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Expected output looks like this:&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 25 May 2020 15:49:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Page-filter-gets-ignored-in-measure/m-p/1118136#M16402</guid>
      <dc:creator>a_gaisin</dc:creator>
      <dc:date>2020-05-25T15:49:49Z</dc:date>
    </item>
    <item>
      <title>Re: Page filter gets ignored in measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Page-filter-gets-ignored-in-measure/m-p/1118179#M16411</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="228639" data-lia-user-login="a_gaisin" class="lia-mention lia-mention-user"&gt;a_gaisin&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Try this&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;Count ABC with IF =
VAR _initsymbol =
    DISTINCT ( symbol_type[init_symbol] )
VAR _projectids =
    CALCULATETABLE (
        DISTINCT ( 'Table'[project id] ),
        FILTER (
            ALL ( 'Table' ),
            'Table'[first_symbol]
                IN _initsymbol
        )
    )
VAR _count =
    CALCULATE (
        COUNT ( 'Table'[code] ),
        'Table'[code] = "ABC"
    )
VAR _result =
    IF (
        ISBLANK ( _count ),
        0,
        _count
    )
RETURN
    IF (
        SELECTEDVALUE ( 'Table'[project id] )
            IN _projectids,
        _result,
        BLANK ()
    )&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Did I answer your question? Mark my post as a solution!&lt;BR /&gt;Appreciate with a kudos &lt;/STRONG&gt;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 25 May 2020 16:40:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Page-filter-gets-ignored-in-measure/m-p/1118179#M16411</guid>
      <dc:creator>nandukrishnavs</dc:creator>
      <dc:date>2020-05-25T16:40:17Z</dc:date>
    </item>
    <item>
      <title>Re: Page filter gets ignored in measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Page-filter-gets-ignored-in-measure/m-p/1120224#M16485</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="32333" data-lia-user-login="nandukrishnavs" class="lia-mention lia-mention-user"&gt;nandukrishnavs&lt;/a&gt;&amp;nbsp;thank you, it works!&lt;/P&gt;</description>
      <pubDate>Tue, 26 May 2020 12:25:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Page-filter-gets-ignored-in-measure/m-p/1120224#M16485</guid>
      <dc:creator>a_gaisin</dc:creator>
      <dc:date>2020-05-26T12:25:47Z</dc:date>
    </item>
  </channel>
</rss>

