<?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: Remove the Row context while keeping Filter context in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Remove-the-Row-context-while-keeping-Filter-context/m-p/3310941#M123771</link>
    <description>&lt;P&gt;Try this for Internal Transactions, it will match the Laboratories example, but NOT match the Engineering as I don't see the data for Engineering + Cost Personnel in your example.&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;LI-CODE lang="csharp"&gt;Internal Transactions = 
var _selPL = SELECTEDVALUE(TableTransactions[Product Line])
var _selPLRow = SELECTEDVALUE(TableTransactions[P&amp;amp;L_Row])

RETURN 
CALCULATE(
	SUM('TableTransactions'[Amount]),
    FILTER( ALLSELECTED(TableTransactions), TableTransactions[Product Line] = _selPL 
                    &amp;amp;&amp;amp; TableTransactions[P&amp;amp;L_Row] = _selPLRow
                    &amp;amp;&amp;amp; CONTAINSSTRING(TableTransactions[Company], "Comp")
                    &amp;amp;&amp;amp; CONTAINSSTRING(TableTransactions[Counterpart], "Comp")
    ) 
)&lt;/LI-CODE&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;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sevenhills_0-1688174913530.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/936007i08391E430ABFF52D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="sevenhills_0-1688174913530.png" alt="sevenhills_0-1688174913530.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For the Internal Eliminations,&lt;/P&gt;
&lt;P&gt;* Are you trying to show the same value for Costs* rows as Internal Transactions value? &lt;BR /&gt;* For Revenue Services rows, are you just negating this above calculated sum of all costs rows value?&lt;/P&gt;
&lt;P&gt;* For the rest of the rows, you are showing as zero... Kind of not clear!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Tried some DAX to get what you need ...&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;Internal Eliminations = 
var _selPL = SELECTEDVALUE(TableTransactions[Product Line])
var _selPLRow = SELECTEDVALUE(TableTransactions[P&amp;amp;L_Row])
var _selCompany = SELECTEDVALUE(TableTransactions[Company])
var _selCounterpart = SELECTEDVALUE(TableTransactions[Counterpart])

var _Tmp1 = ABS( CALCULATE(
	SUM('TableTransactions'[Amount]),
    FILTER( ALL(TableTransactions), TableTransactions[Product Line] = _selPL
                                    &amp;amp;&amp;amp; CONTAINSSTRING(TableTransactions[P&amp;amp;L_Row], "Costs")
    ) 
))

RETURN SWITCH (TRUE()
            , CONTAINSSTRING(_selPLRow, "Costs"), [Internal Transactions]
            , CONTAINSSTRING(_selPLRow, "Revenues Services"), _Tmp1 
        , 0)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sevenhills_1-1688175885783.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/936008i99D3B6BE040C8DA3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="sevenhills_1-1688175885783.png" alt="sevenhills_1-1688175885783.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Hope this helps or tune to your requirements!&lt;/P&gt;</description>
    <pubDate>Sat, 01 Jul 2023 01:46:58 GMT</pubDate>
    <dc:creator>sevenhills</dc:creator>
    <dc:date>2023-07-01T01:46:58Z</dc:date>
    <item>
      <title>Remove the Row context while keeping Filter context</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Remove-the-Row-context-while-keeping-Filter-context/m-p/3310423#M123738</link>
      <description>&lt;P&gt;Hi community,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a table like the following, where Comp_x are companies belonging to the same group (owner).&lt;/P&gt;&lt;P&gt;Table: "&lt;STRONG&gt;Transactions&lt;/STRONG&gt;"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="Screenshot_1.jpg" style="width: 999px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/935835i43ABE64777491A75/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot_1.jpg" alt="Screenshot_1.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My goal is to write a &lt;STRONG&gt;DAX measure&lt;/STRONG&gt; that calculates internal transactions (ie: transactions between my companies only, excluding third parties), and also the "Eliminations" of such internal transactions, defining an elimination as "&lt;STRONG&gt;the minimum amount between the sum of transactions of Company vs Counterparts in the same Product Line&lt;/STRONG&gt;". Therefore, the sum of Elimination column must be always zero.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Examples, setting a Filter Context on "Engineering" in the report page, the expected result by Product Line on my visual should be:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="Screenshot_2.jpg" style="width: 999px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/935837i879B75C31F581841/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot_2.jpg" alt="Screenshot_2.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the first, the minimum is represented by the sum of Costs (-30) that remains within the same product line (purchases of Comp_2 vs Comp_1), so the amount of Internal Eliminations on Revenues of Comp_1 becomes 30 as well.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;While setting&amp;nbsp;a Filter Context on "Laboratories" in the report page, the expected result by Product Line on my visual should be:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="Screenshot_3.jpg" style="width: 999px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/935840i2E4C2AD26941EFE6/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot_3.jpg" alt="Screenshot_3.jpg" /&gt;&lt;/span&gt;&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;In the second example, the minimum is represented by&amp;nbsp;by the sum of Costs (-55) that remains within the same product line (purchases of Comp_2 vs Comp_1), but in this case Revenues are splitted in 2 kinds. Since there's no link between Revenues of Companies, and Costs of respective Counterparts, the measure should calculate the Elimination starting from the first revenues&amp;nbsp; transactions, until the accumulated limit of 55 is reached.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm struggling to find a solution due to the presence of Filter Context and Row Context, both coexisting.&lt;/P&gt;&lt;P&gt;The logics behind my measures is the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;[Internal Transactions]&lt;/STRONG&gt; = "Calculates the Sum of Amount, by P&amp;amp;L Row, where Companies and Counterparts belong to the same&amp;nbsp; filtered Product Line"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;[Internal Eliminations]&lt;/STRONG&gt; = "Calculates the Minimum between the Internal Transactions of each Company vs Counterpart,&amp;nbsp; within she same filtered product line, and assign such minimum value (the limit) to transactions grouped by P&amp;amp;L Row".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hopefully somebody could help me to figure out how to setup the measures.&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;Marco&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A title="Data - Example" href="https://www.dropbox.com/s/9hxnh48wpyw78t7/Example.xlsx?dl=0" target="_blank" rel="noopener"&gt;Download Example (xlsx)&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Jun 2023 15:02:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Remove-the-Row-context-while-keeping-Filter-context/m-p/3310423#M123738</guid>
      <dc:creator>marcofalzone</dc:creator>
      <dc:date>2023-06-30T15:02:24Z</dc:date>
    </item>
    <item>
      <title>Re: Remove the Row context while keeping Filter context</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Remove-the-Row-context-while-keeping-Filter-context/m-p/3310941#M123771</link>
      <description>&lt;P&gt;Try this for Internal Transactions, it will match the Laboratories example, but NOT match the Engineering as I don't see the data for Engineering + Cost Personnel in your example.&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;LI-CODE lang="csharp"&gt;Internal Transactions = 
var _selPL = SELECTEDVALUE(TableTransactions[Product Line])
var _selPLRow = SELECTEDVALUE(TableTransactions[P&amp;amp;L_Row])

RETURN 
CALCULATE(
	SUM('TableTransactions'[Amount]),
    FILTER( ALLSELECTED(TableTransactions), TableTransactions[Product Line] = _selPL 
                    &amp;amp;&amp;amp; TableTransactions[P&amp;amp;L_Row] = _selPLRow
                    &amp;amp;&amp;amp; CONTAINSSTRING(TableTransactions[Company], "Comp")
                    &amp;amp;&amp;amp; CONTAINSSTRING(TableTransactions[Counterpart], "Comp")
    ) 
)&lt;/LI-CODE&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;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sevenhills_0-1688174913530.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/936007i08391E430ABFF52D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="sevenhills_0-1688174913530.png" alt="sevenhills_0-1688174913530.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For the Internal Eliminations,&lt;/P&gt;
&lt;P&gt;* Are you trying to show the same value for Costs* rows as Internal Transactions value? &lt;BR /&gt;* For Revenue Services rows, are you just negating this above calculated sum of all costs rows value?&lt;/P&gt;
&lt;P&gt;* For the rest of the rows, you are showing as zero... Kind of not clear!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Tried some DAX to get what you need ...&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;Internal Eliminations = 
var _selPL = SELECTEDVALUE(TableTransactions[Product Line])
var _selPLRow = SELECTEDVALUE(TableTransactions[P&amp;amp;L_Row])
var _selCompany = SELECTEDVALUE(TableTransactions[Company])
var _selCounterpart = SELECTEDVALUE(TableTransactions[Counterpart])

var _Tmp1 = ABS( CALCULATE(
	SUM('TableTransactions'[Amount]),
    FILTER( ALL(TableTransactions), TableTransactions[Product Line] = _selPL
                                    &amp;amp;&amp;amp; CONTAINSSTRING(TableTransactions[P&amp;amp;L_Row], "Costs")
    ) 
))

RETURN SWITCH (TRUE()
            , CONTAINSSTRING(_selPLRow, "Costs"), [Internal Transactions]
            , CONTAINSSTRING(_selPLRow, "Revenues Services"), _Tmp1 
        , 0)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sevenhills_1-1688175885783.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/936008i99D3B6BE040C8DA3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="sevenhills_1-1688175885783.png" alt="sevenhills_1-1688175885783.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Hope this helps or tune to your requirements!&lt;/P&gt;</description>
      <pubDate>Sat, 01 Jul 2023 01:46:58 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Remove-the-Row-context-while-keeping-Filter-context/m-p/3310941#M123771</guid>
      <dc:creator>sevenhills</dc:creator>
      <dc:date>2023-07-01T01:46:58Z</dc:date>
    </item>
    <item>
      <title>Re: Remove the Row context while keeping Filter context</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Remove-the-Row-context-while-keeping-Filter-context/m-p/3321094#M124301</link>
      <description>&lt;P&gt;Dear&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/29249"&gt;@sevenhills&lt;/a&gt;&amp;nbsp;, I really appreciate your effort. Thank you very much for your kind and precise reply.&amp;nbsp;&lt;BR /&gt;I do apologize for this late reply, I've been travelling this week. I'm going to have a deep dive into your message, and I'll be back with a feedback within this weekend.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Thanks again for your contribution, I do really appreciate!&lt;BR /&gt;&lt;BR /&gt;Marco - Monterrey, Mexico.&lt;/P&gt;</description>
      <pubDate>Sat, 08 Jul 2023 00:27:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Remove-the-Row-context-while-keeping-Filter-context/m-p/3321094#M124301</guid>
      <dc:creator>marcofalzone</dc:creator>
      <dc:date>2023-07-08T00:27:11Z</dc:date>
    </item>
  </channel>
</rss>

