<?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 difference in cost based on combined query results in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-difference-in-cost-based-on-combined-query-results/m-p/2798235#M87985</link>
    <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="447590" data-lia-user-login="Mido99" class="lia-mention lia-mention-user"&gt;Mido99&lt;/a&gt; , if you need a column &lt;/P&gt;
&lt;P&gt;Cost 4010&amp;nbsp;&amp;nbsp; =&lt;/P&gt;
&lt;P&gt;sumx(filter(Table, Table[Project ID]= 4010&amp;nbsp; &amp;amp;&amp;amp; Table[Activity ID] = earlier(Table[Activity ID] ) ), Table[Cost])&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;cost 3844 =&lt;/P&gt;
&lt;P&gt;sumx(filter(Table, Table[Project ID]= 3844 &amp;amp;&amp;amp; Table[Activity ID] = earlier(Table[Activity ID] ) ), Table[Cost])&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if you need measure&lt;/P&gt;
&lt;P&gt;calculate(sum(Table[Cost]), Table[Project ID]= 3844 )&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;or&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;calculate(sum(Table[Cost]), Table[Project ID]= 4010)&lt;/P&gt;</description>
    <pubDate>Tue, 27 Sep 2022 02:18:41 GMT</pubDate>
    <dc:creator>amitchandak</dc:creator>
    <dc:date>2022-09-27T02:18:41Z</dc:date>
    <item>
      <title>Calculate difference in cost based on combined query results</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-difference-in-cost-based-on-combined-query-results/m-p/2797307#M87943</link>
      <description>&lt;P&gt;hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i have a table in Power BI that is the result of a combined query (3 tables), which means i have a column with 3 different project IDs (4010 = current project, 3844 = previous month's project, 3653 = baseline)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i have another column called "actual cost" and what i would like to do is add a calculated column that calculates for each row the difference between the actual cost in ID 4010 vs ID 3844, based on the denominator activity ID or name.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;how would i go about doing this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thank you in advance&lt;/P&gt;</description>
      <pubDate>Mon, 26 Sep 2022 16:58:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-difference-in-cost-based-on-combined-query-results/m-p/2797307#M87943</guid>
      <dc:creator>Mido99</dc:creator>
      <dc:date>2022-09-26T16:58:00Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate difference in cost based on combined query results</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-difference-in-cost-based-on-combined-query-results/m-p/2798235#M87985</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="447590" data-lia-user-login="Mido99" class="lia-mention lia-mention-user"&gt;Mido99&lt;/a&gt; , if you need a column &lt;/P&gt;
&lt;P&gt;Cost 4010&amp;nbsp;&amp;nbsp; =&lt;/P&gt;
&lt;P&gt;sumx(filter(Table, Table[Project ID]= 4010&amp;nbsp; &amp;amp;&amp;amp; Table[Activity ID] = earlier(Table[Activity ID] ) ), Table[Cost])&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;cost 3844 =&lt;/P&gt;
&lt;P&gt;sumx(filter(Table, Table[Project ID]= 3844 &amp;amp;&amp;amp; Table[Activity ID] = earlier(Table[Activity ID] ) ), Table[Cost])&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if you need measure&lt;/P&gt;
&lt;P&gt;calculate(sum(Table[Cost]), Table[Project ID]= 3844 )&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;or&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;calculate(sum(Table[Cost]), Table[Project ID]= 4010)&lt;/P&gt;</description>
      <pubDate>Tue, 27 Sep 2022 02:18:41 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-difference-in-cost-based-on-combined-query-results/m-p/2798235#M87985</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2022-09-27T02:18:41Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate difference in cost based on combined query results</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-difference-in-cost-based-on-combined-query-results/m-p/2798275#M87990</link>
      <description>&lt;P&gt;&lt;FONT&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="447590" data-lia-user-login="Mido99" class="lia-mention lia-mention-user"&gt;Mido99&lt;/a&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for reaching out to us.&lt;/P&gt;
&lt;P&gt;My suggestion is to find the values where project ID=4010 and 3653 by denominator activity ID, and then calculate the difference. &lt;STRONG&gt;&lt;EM&gt;For example,&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;sample data&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Column = 
var _4010=MAXX(FILTER(ALL('Table'),'Table'[denominator activity ID]=EARLIER('Table'[denominator activity ID]) &amp;amp;&amp;amp; [project IDs]=4010),[actual cost])
var _3844=MAXX(FILTER(ALL('Table'),'Table'[denominator activity ID]=EARLIER('Table'[denominator activity ID]) &amp;amp;&amp;amp; [project IDs]=3844),[actual cost])
return _3844-_4010&lt;/LI-CODE&gt;
&lt;P&gt;result&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Community Support Team _Tang&lt;/P&gt;
&lt;P&gt;If this post&amp;nbsp;&lt;STRONG&gt;helps&lt;/STRONG&gt;, please consider&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt;&amp;nbsp;to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Sep 2022 02:29:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-difference-in-cost-based-on-combined-query-results/m-p/2798275#M87990</guid>
      <dc:creator>v-xiaotang</dc:creator>
      <dc:date>2022-09-27T02:29:05Z</dc:date>
    </item>
  </channel>
</rss>

