<?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: SUMX() and Filter an operation in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-and-Filter-an-operation/m-p/3738601#M145754</link>
    <description>&lt;P&gt;It worked!!&amp;nbsp;&lt;SPAN&gt;Thank you very much!!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 04 Mar 2024 01:30:03 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2024-03-04T01:30:03Z</dc:date>
    <item>
      <title>SUMX() and Filter an operation</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-and-Filter-an-operation/m-p/3736544#M145647</link>
      <description>&lt;P&gt;Hi people... I'm having a problem with a DAX formula.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to get the absolute difference between two columns ( "HH ASIGNADAS" and "HH EJECUTADAS")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now, in those cases in which there is no value in the "HH ASIGNADAS" column, said difference should not be made.&amp;nbsp;To achieve this I'm using the following expression (&lt;SPAN&gt;measure)&lt;/SPAN&gt;:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;DIF = SUMX(VALUES(ENTREGABLES[CODIGO ENTREGABLE]), IF(HASONEVALUE(BBDD1[HH ASIGNADAS]),[DIF_ABSOLUTA], BLANK()))&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Where:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;DIF_ABSOLUTA = ABS(SUM(BBDD1[HH ASIGNADAS])-SUM(HH_ejecutadas_minedoc[Horas_ejecutadas]))&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;STRONG&gt;BBDD1[HH ASIGNADAS])&lt;/STRONG&gt; =&amp;nbsp;Hours that were assigned to professionals.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;STRONG&gt;HH_ejecutadas_minedoc[Horas_ejecutadas]&lt;/STRONG&gt; =&amp;nbsp;Hours that were executed by professionals&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;And&amp;nbsp;&lt;STRONG&gt;ENTREGABLES[CODIGO ENTREGABLE]&lt;/STRONG&gt; is a column that contains all the codes of the documents on which the professionals work.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;SPAN&gt;Locally the expression is working, but it is not giving me a final result (which is the value I am actually looking for). If in the "IF" condition I leave "BLANK()" for when it is not met, I get "BLANK" as a total sum, and line by line it looks like the image above.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;img /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;SPAN&gt;Now, if for example I change the "BLANK()" to "0",&amp;nbsp;the table looks like this:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;img /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;SPAN&gt;And the final result gives me zero:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;img /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;SPAN&gt;The same thing that happens with zero happens if I put a one for example.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;SPAN&gt;I hope the problem is clear. Any help is welcome.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;Thank you very much and greetings&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;STRONG&gt;Additional comments&lt;/STRONG&gt;: I also tried using the CALCULATE() function but nothing happens&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;DIF_CALCULATE = SUMX(VALUES(ENTREGABLES[CODIGO ENTREGABLE]), CALCULATE([DIF_ABSOLUTA], BBDD1[HH ASIGNADAS] &amp;lt;&amp;gt; BLANK()))&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Directly it is as if it does not apply any filter and does the operation regardless of whether "HH ASIGNADAS" has information or not&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;img /&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;In the latter case it doesn't matter if I use "BLANK()" or zero, etc.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;The data model:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;img /&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 01 Mar 2024 15:17:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-and-Filter-an-operation/m-p/3736544#M145647</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-03-01T15:17:18Z</dc:date>
    </item>
    <item>
      <title>Re: SUMX() and Filter an operation</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-and-Filter-an-operation/m-p/3736828#M145661</link>
      <description>&lt;P&gt;I'd try this and tweak as necessary:&lt;/P&gt;
&lt;LI-CODE lang="php"&gt;DIF =
SUMX (
    VALUES ( ENTREGABLES[CODIGO ENTREGABLE] ),
    VAR _Asignadas = CALCULATE ( SUM ( BBDD1[HH ASIGNADAS] ) )
    VAR _Ejutadas = CALCULATE ( SUM ( HH_ejecutadas_minedoc[Horas_ejecutadas] ) )
    RETURN
        IF (
            ISBLANK ( _Asignadas ), /*|| ISBLANK ( _Ejutatas ),*/
            BLANK (),
            ABS ( _Asignadas - _Ejutadas )
        )
)&lt;/LI-CODE&gt;
&lt;P&gt;I've included a commented-out part that you can include if you want to check both are nonblank.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Mar 2024 17:27:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-and-Filter-an-operation/m-p/3736828#M145661</guid>
      <dc:creator>AlexisOlson</dc:creator>
      <dc:date>2024-03-01T17:27:54Z</dc:date>
    </item>
    <item>
      <title>Re: SUMX() and Filter an operation</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-and-Filter-an-operation/m-p/3738601#M145754</link>
      <description>&lt;P&gt;It worked!!&amp;nbsp;&lt;SPAN&gt;Thank you very much!!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Mar 2024 01:30:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-and-Filter-an-operation/m-p/3738601#M145754</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-03-04T01:30:03Z</dc:date>
    </item>
    <item>
      <title>Re: SUMX() and Filter an operation</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-and-Filter-an-operation/m-p/3738609#M145755</link>
      <description>&lt;P&gt;Can I ask you a question? Why did you use Calculate in this expression and not just SUM?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;VAR&lt;/SPAN&gt;&lt;SPAN&gt; _Asignadas = &lt;/SPAN&gt;&lt;STRONG&gt;CALCULATE&lt;/STRONG&gt;&lt;SPAN&gt; ( &lt;/SPAN&gt;&lt;SPAN&gt;SUM&lt;/SPAN&gt;&lt;SPAN&gt; ( BBDD1[HH ASIGNADAS] ) )&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 04 Mar 2024 01:36:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-and-Filter-an-operation/m-p/3738609#M145755</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-03-04T01:36:29Z</dc:date>
    </item>
    <item>
      <title>Re: SUMX() and Filter an operation</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-and-Filter-an-operation/m-p/3741031#M145888</link>
      <description>&lt;P&gt;Context transition. I want the SUM to be calculated within the context of the current&amp;nbsp;ENTREGABLES[CODIGO ENTREGABLE] row of SUMX.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Further reading:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.sqlbi.com/articles/understanding-context-transition/" target="_blank"&gt;https://www.sqlbi.com/articles/understanding-context-transition/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.sqlbi.com/articles/understanding-context-transition-in-dax/" target="_blank"&gt;https://www.sqlbi.com/articles/understanding-context-transition-in-dax/&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Mar 2024 21:34:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUMX-and-Filter-an-operation/m-p/3741031#M145888</guid>
      <dc:creator>AlexisOlson</dc:creator>
      <dc:date>2024-03-04T21:34:54Z</dc:date>
    </item>
  </channel>
</rss>

