<?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: calculate total  from comparing two difrent measure in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculate-total-from-comparing-two-difrent-measure/m-p/4173525#M165747</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="812019" data-lia-user-login="a-tlantis" class="lia-mention lia-mention-user"&gt;a-tlantis&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://d13ot9o61jdzpp.cloudfront.net/files/pbiforum/a-tlantis.pbix" target="_self"&gt;Download my PBIX file with the example below&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you provide an example of exactly what you expect as a result that would be helpful, but I think I get it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="php"&gt;Measure 1 = SUM(TableA[amount])&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="php"&gt;Measure 2 = CALCULATE(SUM('TableB'[maxamount]), 'TableB'[recep] = SELECTEDVALUE('TableA'[recep]))&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="php"&gt;Measure 3 = IF([Measure 1] &amp;lt; [Measure 2], [Measure 1], IF([Measure 2] = 0, [Measure 1], [Measure 2]))&lt;/LI-CODE&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;NOTE: the two tables are related on the recep column.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Phil&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 25 Sep 2024 08:43:23 GMT</pubDate>
    <dc:creator>PhilipTreacy</dc:creator>
    <dc:date>2024-09-25T08:43:23Z</dc:date>
    <item>
      <title>calculate total  from comparing two difrent measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculate-total-from-comparing-two-difrent-measure/m-p/4172914#M165728</link>
      <description>&lt;P&gt;hello everyone&lt;/P&gt;&lt;P&gt;i have two measures that they are from two diffrent tables and then i have third measure that it values comes from comparison from those two measures.the challange i have is when i want to have total of third measure&amp;nbsp; power bi&amp;nbsp; gives the wrong number.&lt;/P&gt;&lt;P&gt;this is&amp;nbsp;&amp;nbsp; data.idea is&amp;nbsp; when sum of amount for specific recep is more than maxamount in table b&amp;nbsp; and maxamount is not zerro&amp;nbsp; the third measure should be&amp;nbsp; maxamount value&amp;nbsp; otherwise should be sum of amount . my challange is total of the third measure .&lt;/P&gt;&lt;P&gt;table a&lt;/P&gt;&lt;P&gt;id &amp;nbsp;&amp;nbsp; recep&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; amount &amp;nbsp;&amp;nbsp; date&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; a-40 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 200&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2023-02-05&lt;/P&gt;&lt;P&gt;2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; a-40 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 20&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2023-03-01&lt;/P&gt;&lt;P&gt;3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; a-50&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 100 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2023-05-01&lt;/P&gt;&lt;P&gt;4&amp;nbsp;&amp;nbsp;&amp;nbsp; a-50&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 70&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2023-06-22&lt;/P&gt;&lt;P&gt;5&amp;nbsp;&amp;nbsp; a-60&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; 10&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; 2023-04-17&lt;/P&gt;&lt;P&gt;table b&lt;/P&gt;&lt;P&gt;id &amp;nbsp;&amp;nbsp; recep &amp;nbsp; &amp;nbsp; maxamount&lt;/P&gt;&lt;P&gt;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; a-40&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1000&lt;/P&gt;&lt;P&gt;2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; a-50&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 50&lt;/P&gt;&lt;P&gt;3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; a-60&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&lt;/P&gt;</description>
      <pubDate>Wed, 25 Sep 2024 06:35:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculate-total-from-comparing-two-difrent-measure/m-p/4172914#M165728</guid>
      <dc:creator>a-tlantis</dc:creator>
      <dc:date>2024-09-25T06:35:09Z</dc:date>
    </item>
    <item>
      <title>Re: calculate total  from comparing two difrent measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculate-total-from-comparing-two-difrent-measure/m-p/4172926#M165729</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="812019" data-lia-user-login="a-tlantis" class="lia-mention lia-mention-user"&gt;a-tlantis&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please provide your measures, hard to solve this without seeing what your calculations are doing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Phil&lt;/P&gt;</description>
      <pubDate>Wed, 25 Sep 2024 06:41:02 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculate-total-from-comparing-two-difrent-measure/m-p/4172926#M165729</guid>
      <dc:creator>PhilipTreacy</dc:creator>
      <dc:date>2024-09-25T06:41:02Z</dc:date>
    </item>
    <item>
      <title>Re: calculate total  from comparing two difrent measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculate-total-from-comparing-two-difrent-measure/m-p/4173046#M165733</link>
      <description>&lt;P&gt;first measure&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = sum ( amount ) based on recep column&lt;/P&gt;&lt;P&gt;second measure = sum (maxamount) based on recep column&lt;/P&gt;</description>
      <pubDate>Wed, 25 Sep 2024 06:57:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculate-total-from-comparing-two-difrent-measure/m-p/4173046#M165733</guid>
      <dc:creator>a-tlantis</dc:creator>
      <dc:date>2024-09-25T06:57:34Z</dc:date>
    </item>
    <item>
      <title>Re: calculate total  from comparing two difrent measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculate-total-from-comparing-two-difrent-measure/m-p/4173525#M165747</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="812019" data-lia-user-login="a-tlantis" class="lia-mention lia-mention-user"&gt;a-tlantis&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://d13ot9o61jdzpp.cloudfront.net/files/pbiforum/a-tlantis.pbix" target="_self"&gt;Download my PBIX file with the example below&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you provide an example of exactly what you expect as a result that would be helpful, but I think I get it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="php"&gt;Measure 1 = SUM(TableA[amount])&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="php"&gt;Measure 2 = CALCULATE(SUM('TableB'[maxamount]), 'TableB'[recep] = SELECTEDVALUE('TableA'[recep]))&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="php"&gt;Measure 3 = IF([Measure 1] &amp;lt; [Measure 2], [Measure 1], IF([Measure 2] = 0, [Measure 1], [Measure 2]))&lt;/LI-CODE&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;NOTE: the two tables are related on the recep column.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Phil&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Sep 2024 08:43:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculate-total-from-comparing-two-difrent-measure/m-p/4173525#M165747</guid>
      <dc:creator>PhilipTreacy</dc:creator>
      <dc:date>2024-09-25T08:43:23Z</dc:date>
    </item>
    <item>
      <title>Re: calculate total  from comparing two difrent measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculate-total-from-comparing-two-difrent-measure/m-p/4173634#M165752</link>
      <description>&lt;P&gt;THANKS BUT MY ISSUE IS WHEN I WANT THE TOTAL OF THE THIRD MEASURE POWER BI GIVE ME WRONG NUMBER&lt;/P&gt;</description>
      <pubDate>Wed, 25 Sep 2024 09:17:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculate-total-from-comparing-two-difrent-measure/m-p/4173634#M165752</guid>
      <dc:creator>a-tlantis</dc:creator>
      <dc:date>2024-09-25T09:17:53Z</dc:date>
    </item>
    <item>
      <title>Re: calculate total  from comparing two difrent measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculate-total-from-comparing-two-difrent-measure/m-p/4173984#M165767</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="812019" data-lia-user-login="a-tlantis" class="lia-mention lia-mention-user"&gt;a-tlantis&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Without you explaining what you mean by &lt;STRONG&gt;wrong number&lt;/STRONG&gt; and showing an example of what you expect as the right number, it's hard to give you a solution.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What exactly is wrong with the table of data in my solution?&amp;nbsp; What do you want as the values in that column for Measure 3?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Phil&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Sep 2024 10:45:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculate-total-from-comparing-two-difrent-measure/m-p/4173984#M165767</guid>
      <dc:creator>PhilipTreacy</dc:creator>
      <dc:date>2024-09-25T10:45:54Z</dc:date>
    </item>
    <item>
      <title>Re: calculate total  from comparing two difrent measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculate-total-from-comparing-two-difrent-measure/m-p/4176469#M165829</link>
      <description>&lt;P&gt;Hi&amp;nbsp;PhilipTreacy&amp;nbsp;,thanks for the quick reply, I'll add more.&lt;/P&gt;
&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="812019" data-lia-user-login="a-tlantis" class="lia-mention lia-mention-user"&gt;a-tlantis&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;Are you referring to the error here?&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Try modifying your third measure&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure 3 = 
VAR _result =
    IF ( [Measure] &amp;gt; [Measure 2] &amp;amp;&amp;amp; [Measure 2] &amp;lt;&amp;gt; 0, [Measure 2], [Measure] )
VAR _table =
    ADDCOLUMNS (
        SUMMARIZE ( 'Table2', [recep], "Measure1", [Measure], "Measre2", [Measure 2] ),
        "Measure3",
            IF ( [Measure1] &amp;gt; [Measre2] &amp;amp;&amp;amp; [Measre2] &amp;lt;&amp;gt; 0, [Measre2], [Measure1] )
    )
RETURN
    IF (
        ISBLANK ( SELECTEDVALUE ( Table2[recep] ) ),
        SUMX ( _table, [Measure3] ),
        _result
    )&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Wenbin Zhou&lt;/P&gt;</description>
      <pubDate>Thu, 26 Sep 2024 03:42:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculate-total-from-comparing-two-difrent-measure/m-p/4176469#M165829</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-09-26T03:42:22Z</dc:date>
    </item>
  </channel>
</rss>

