<?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 NPS Score with a Filter (Different Table) in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/NPS-Score-with-a-Filter-Different-Table/m-p/1878490#M40322</link>
    <description>&lt;P&gt;&lt;FONT size="3"&gt;Hi All -&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;Ca&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;n anyone help me debug my code -- I'm building a time series and want to show NPS (all clients), NPS (Client Group 1), NPS (Client Group 2), etc. The Client Group designation lives on another table, but they are tied together in my model.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif" size="2"&gt;The expression provides the accurate net promoter score without a filter context, but once I throw that filter context on, nothing actually changes in terms of the score -- however, when I physically add the field as a filter on the visual and select 'Client Group 1', for example, I get the proper NPS for Client Group 1.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif" size="2"&gt;Since these are all going to be living on the same line graph, I'm trying to create a custom measure for each. Appreciate any advice - hopefully, it's something super simple that I'm just not catching being relatively new to the wonderful world of DAX! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif" size="2"&gt;NPS Calc (Client Group 1) =&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif" size="2"&gt;VAR Promoter =&lt;/FONT&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif" size="2"&gt;&lt;SPAN&gt;CALCULATE(COUNTA('Simple Survey'[MASTER NPS FIELD 1]), 'Simple Survey'[MASTER NPS FIELD 1] in {"Promoter"})&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif" size="2"&gt;VAR Detractor&amp;nbsp; =&lt;/FONT&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif" size="2"&gt;&lt;SPAN&gt;CALCULATE(COUNTA('Simple Survey'[MASTER NPS FIELD 1]), 'Simple Survey'[MASTER NPS FIELD 1] in {"Detractor"})&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif" size="2"&gt;&lt;SPAN&gt;VAR All_NPS =&amp;nbsp;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif" size="2"&gt;&lt;SPAN&gt;CALCULATE(COUNTA('Simple Survey'[MASTER NPS FIELD 1]), 'Simple Survey'[MASTER NPS FIELD 1] in {"Detractor", "Promoter", "Passive"})&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif" size="2"&gt;VAR prom_minus_detractor = promoter-detractor&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif" size="2"&gt;RETURN&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif" size="2"&gt;CALCULATE(DIVIDE(prom_minus_detractor , ALL_NPS), 'Clients'[Client_Group] in {"Client Group 1"})&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif" size="2"&gt;Thank you in advance!!&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 02 Jun 2021 18:57:56 GMT</pubDate>
    <dc:creator>samdep</dc:creator>
    <dc:date>2021-06-02T18:57:56Z</dc:date>
    <item>
      <title>NPS Score with a Filter (Different Table)</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/NPS-Score-with-a-Filter-Different-Table/m-p/1878490#M40322</link>
      <description>&lt;P&gt;&lt;FONT size="3"&gt;Hi All -&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;Ca&lt;FONT face="tahoma,arial,helvetica,sans-serif"&gt;n anyone help me debug my code -- I'm building a time series and want to show NPS (all clients), NPS (Client Group 1), NPS (Client Group 2), etc. The Client Group designation lives on another table, but they are tied together in my model.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif" size="2"&gt;The expression provides the accurate net promoter score without a filter context, but once I throw that filter context on, nothing actually changes in terms of the score -- however, when I physically add the field as a filter on the visual and select 'Client Group 1', for example, I get the proper NPS for Client Group 1.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif" size="2"&gt;Since these are all going to be living on the same line graph, I'm trying to create a custom measure for each. Appreciate any advice - hopefully, it's something super simple that I'm just not catching being relatively new to the wonderful world of DAX! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif" size="2"&gt;NPS Calc (Client Group 1) =&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif" size="2"&gt;VAR Promoter =&lt;/FONT&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif" size="2"&gt;&lt;SPAN&gt;CALCULATE(COUNTA('Simple Survey'[MASTER NPS FIELD 1]), 'Simple Survey'[MASTER NPS FIELD 1] in {"Promoter"})&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif" size="2"&gt;VAR Detractor&amp;nbsp; =&lt;/FONT&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif" size="2"&gt;&lt;SPAN&gt;CALCULATE(COUNTA('Simple Survey'[MASTER NPS FIELD 1]), 'Simple Survey'[MASTER NPS FIELD 1] in {"Detractor"})&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif" size="2"&gt;&lt;SPAN&gt;VAR All_NPS =&amp;nbsp;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif" size="2"&gt;&lt;SPAN&gt;CALCULATE(COUNTA('Simple Survey'[MASTER NPS FIELD 1]), 'Simple Survey'[MASTER NPS FIELD 1] in {"Detractor", "Promoter", "Passive"})&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif" size="2"&gt;VAR prom_minus_detractor = promoter-detractor&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif" size="2"&gt;RETURN&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif" size="2"&gt;CALCULATE(DIVIDE(prom_minus_detractor , ALL_NPS), 'Clients'[Client_Group] in {"Client Group 1"})&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="tahoma,arial,helvetica,sans-serif" size="2"&gt;Thank you in advance!!&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Jun 2021 18:57:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/NPS-Score-with-a-Filter-Different-Table/m-p/1878490#M40322</guid>
      <dc:creator>samdep</dc:creator>
      <dc:date>2021-06-02T18:57:56Z</dc:date>
    </item>
    <item>
      <title>Re: NPS Score with a Filter (Different Table)</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/NPS-Score-with-a-Filter-Different-Table/m-p/1878512#M40325</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="294395" data-lia-user-login="samdep" class="lia-mention lia-mention-user"&gt;samdep&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;When you use Variables as Expressions inside CALCULATE, they are not evaluated by the filters in CALCULATE, variables are constant.Try the following modified&amp;nbsp; version:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;NPS Calc (Client Group 1) =
CALCULATE (
    DIVIDE (
        VAR Promoter =
            CALCULATE (
                COUNTA ( 'Simple Survey'[MASTER NPS FIELD 1] ),
                'Simple Survey'[MASTER NPS FIELD 1] IN { "Promoter" }
            )
        VAR Detractor =
            CALCULATE (
                COUNTA ( 'Simple Survey'[MASTER NPS FIELD 1] ),
                'Simple Survey'[MASTER NPS FIELD 1] IN { "Detractor" }
            )
        VAR prom_minus_detractor = promoter - detractor
        RETURN
            prom_minus_detractor,
        VAR All_NPS =
            CALCULATE (
                COUNTA ( 'Simple Survey'[MASTER NPS FIELD 1] ),
                'Simple Survey'[MASTER NPS FIELD 1] IN { "Detractor", "Promoter", "Passive" }
            )
        RETURN
            All_NPS
    ),
    'Clients'[Client_Group] IN { "Client Group 1" }
)&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 02 Jun 2021 19:11:48 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/NPS-Score-with-a-Filter-Different-Table/m-p/1878512#M40325</guid>
      <dc:creator>Fowmy</dc:creator>
      <dc:date>2021-06-02T19:11:48Z</dc:date>
    </item>
    <item>
      <title>Re: NPS Score with a Filter (Different Table)</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/NPS-Score-with-a-Filter-Different-Table/m-p/1880499#M40401</link>
      <description>&lt;P&gt;This worked perfectly, thank you! I didn't realize what you'd said about variables being constant, so that's good to know - thank you!&lt;/P&gt;</description>
      <pubDate>Thu, 03 Jun 2021 15:59:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/NPS-Score-with-a-Filter-Different-Table/m-p/1880499#M40401</guid>
      <dc:creator>samdep</dc:creator>
      <dc:date>2021-06-03T15:59:35Z</dc:date>
    </item>
  </channel>
</rss>

