<?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: Help understanding logical conditions in CALCULATE in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-understanding-logical-conditions-in-CALCULATE/m-p/3767124#M147084</link>
    <description>&lt;P&gt;DAX is no different from other languages in this area.&amp;nbsp; What trips people up is the difference between logic statements and everyday language.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When you say " I want the red shirts and the blue shirts " you can't write it as Shirts="Red" &amp;amp;&amp;amp; Shirts="Blue".&amp;nbsp; The logic equivalent is Shirts="Red" || Shirts = "Blue",&amp;nbsp; or Shirts IN {"Red","Blue"}&lt;/P&gt;</description>
    <pubDate>Fri, 15 Mar 2024 15:55:47 GMT</pubDate>
    <dc:creator>lbendlin</dc:creator>
    <dc:date>2024-03-15T15:55:47Z</dc:date>
    <item>
      <title>Help understanding logical conditions in CALCULATE</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-understanding-logical-conditions-in-CALCULATE/m-p/3766082#M146973</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, I can't get my head around this one (and I'm sure the explanation would be rather easy).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a Likert scale that includes two response categories I want to exclude. These categories are "Did not answer" and "Not applicable." To calculate the count of positive responses I'd do:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Positive satisfaction = 
CALCULATE (
    COUNT ( Table[Response ID] ),
    Table[My scale] = "Very Satisfied"
        || Table[My scale] = "Satisfied"
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then, if I wanted to get some percentages ignoring "Did not answer" and "Not applicable" I know I could do something like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Positive satisfaction % = 
DIVIDE (
    [Positive satisfaction],
    CALCULATE (
        COUNT ( Table[Response ID] ),
        ALL (
            Table[My scale]
        ),
        Table[My scale] &amp;lt;&amp;gt; "Did not answer"
            &amp;amp;&amp;amp; Table[My scale] &amp;lt;&amp;gt; "Not applicable"
    )
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I re-read my code above I instinctively think that the filtering conditioning being used demands that &lt;EM&gt;[Response ID]&lt;/EM&gt; equals both &lt;EM&gt;"Did not answer"&lt;/EM&gt; and &lt;EM&gt;"Not applicable"&lt;/EM&gt; at the same time. What would be the correct interpretation of &lt;EM&gt;CALCULATE&lt;/EM&gt; here? Any and all help very much appreciated. Cheers!&lt;/P&gt;</description>
      <pubDate>Fri, 15 Mar 2024 10:41:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-understanding-logical-conditions-in-CALCULATE/m-p/3766082#M146973</guid>
      <dc:creator>y_s_c</dc:creator>
      <dc:date>2024-03-15T10:41:34Z</dc:date>
    </item>
    <item>
      <title>Re: Help understanding logical conditions in CALCULATE</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-understanding-logical-conditions-in-CALCULATE/m-p/3767050#M147079</link>
      <description>&lt;P&gt;Not sure what your issue is here but if you want you can rewrite the code as&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Positive satisfaction % = 
DIVIDE (
    [Positive satisfaction],
    CALCULATE (
        COUNT ( Table[Response ID] ),
        ALL (
            Table[My scale]
        ),
        Table[My scale] NOT IN {"Did not answer","Not applicable"}
    ),
    0
)&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 15 Mar 2024 15:32:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-understanding-logical-conditions-in-CALCULATE/m-p/3767050#M147079</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2024-03-15T15:32:33Z</dc:date>
    </item>
    <item>
      <title>Re: Help understanding logical conditions in CALCULATE</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-understanding-logical-conditions-in-CALCULATE/m-p/3767112#M147083</link>
      <description>&lt;P&gt;Thanks for your reply. Creating the measure isn't my issue per se. It was more about understanding more deeply what's going on when filtering inside CALCULATE.&lt;BR /&gt;&lt;BR /&gt;I'm more used to other languages and when I see something like the below I instinctively think the filtering works as "something is TRUE, something else is TRUE (at the same time)." Logically, a response can't be "Did not answer" and "Not applicable" at the same time, thus my confusion.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Table[My scale] &amp;lt;&amp;gt; "Did not answer"
            &amp;amp;&amp;amp; Table[My scale] &amp;lt;&amp;gt; "Not applicable"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Mar 2024 15:48:44 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-understanding-logical-conditions-in-CALCULATE/m-p/3767112#M147083</guid>
      <dc:creator>y_s_c</dc:creator>
      <dc:date>2024-03-15T15:48:44Z</dc:date>
    </item>
    <item>
      <title>Re: Help understanding logical conditions in CALCULATE</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-understanding-logical-conditions-in-CALCULATE/m-p/3767124#M147084</link>
      <description>&lt;P&gt;DAX is no different from other languages in this area.&amp;nbsp; What trips people up is the difference between logic statements and everyday language.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When you say " I want the red shirts and the blue shirts " you can't write it as Shirts="Red" &amp;amp;&amp;amp; Shirts="Blue".&amp;nbsp; The logic equivalent is Shirts="Red" || Shirts = "Blue",&amp;nbsp; or Shirts IN {"Red","Blue"}&lt;/P&gt;</description>
      <pubDate>Fri, 15 Mar 2024 15:55:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-understanding-logical-conditions-in-CALCULATE/m-p/3767124#M147084</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2024-03-15T15:55:47Z</dc:date>
    </item>
    <item>
      <title>Re: Help understanding logical conditions in CALCULATE</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-understanding-logical-conditions-in-CALCULATE/m-p/3767153#M147086</link>
      <description>&lt;P&gt;I do understand what you're saying there, and whilst I can write that measure in DAX as originally posted, I still need to pause and think why on earth I need "&amp;amp;&amp;amp;" and not "||".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In R I would think in terms of:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;filter ( myscale != "A" | myscale != "B")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;BR /&gt;But that's not the case inside &lt;EM&gt;CALCULATE&lt;/EM&gt;, is it? Second code chunk in my original post, if changing "&amp;amp;&amp;amp;" to "||" the DENOMINATOR ends up including both categories I want to exclude.&lt;BR /&gt;&lt;BR /&gt;Sorry for keeping having a go at this, but I feel I'm missing something really obvious &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Mar 2024 16:11:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-understanding-logical-conditions-in-CALCULATE/m-p/3767153#M147086</guid>
      <dc:creator>y_s_c</dc:creator>
      <dc:date>2024-03-15T16:11:36Z</dc:date>
    </item>
    <item>
      <title>Re: Help understanding logical conditions in CALCULATE</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-understanding-logical-conditions-in-CALCULATE/m-p/3767162#M147088</link>
      <description>&lt;PRE class=""&gt;&lt;CODE&gt;filter ( myscale != "A" | myscale != "B")&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Careful! this may not do what you think it should do.&amp;nbsp; It evaluates to TRUE as all of your items will satisfy either condition.&lt;/P&gt;
&lt;PRE class=""&gt;&lt;CODE&gt;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 15 Mar 2024 16:16:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-understanding-logical-conditions-in-CALCULATE/m-p/3767162#M147088</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2024-03-15T16:16:11Z</dc:date>
    </item>
    <item>
      <title>Re: Help understanding logical conditions in CALCULATE</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-understanding-logical-conditions-in-CALCULATE/m-p/3771087#M147300</link>
      <description>&lt;P&gt;Just for clarity in case someone finds the above in the future, NOT IN should be instead employed as:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Positive satisfaction % = 
DIVIDE (
    [Positive satisfaction],
    CALCULATE (
        COUNT ( Table[Response ID] ),
        ALL (
            Table[My scale]
        ),
        NOT ( Table[My scale] ) IN {"Did not answer","Not applicable"}
    )
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Mar 2024 09:59:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-understanding-logical-conditions-in-CALCULATE/m-p/3771087#M147300</guid>
      <dc:creator>y_s_c</dc:creator>
      <dc:date>2024-03-18T09:59:23Z</dc:date>
    </item>
  </channel>
</rss>

