<?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: DAX formula to calculate the result between booking values and their share in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-to-calculate-the-result-between-booking-values-and/m-p/2520441#M70233</link>
    <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you share a screenshot of your table visual?&lt;BR /&gt;I have a feeling that this is what you want&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;Result2 =
SUMX (
    CROSSJOIN ( 'fctFinance', 'dimLedger' ),
    - 'fctFinance'[Booking value] * 'dimLedgerExternal'[Share Factor]
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 17 May 2022 12:04:23 GMT</pubDate>
    <dc:creator>tamerj1</dc:creator>
    <dc:date>2022-05-17T12:04:23Z</dc:date>
    <item>
      <title>DAX formula to calculate the result between booking values and their share</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-to-calculate-the-result-between-booking-values-and/m-p/2519566#M70169</link>
      <description>&lt;P&gt;The situation:&lt;/P&gt;&lt;P&gt;I have a fctFinance table and a dimLedgerExternal table via SQL.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The fctFinance table consists among other columns of&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;booking values&lt;/LI&gt;&lt;LI&gt;for each applicable ledger&lt;/LI&gt;&lt;LI&gt;per month&lt;/LI&gt;&lt;LI&gt;booking year,&amp;nbsp;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The dimLedgerExternal table is a DAX written table via the =DATATABLE function to provide a translation between their ledgers and our ledgers and consists of&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Ledger Ext ; the ledger our investment company uses&lt;/LI&gt;&lt;LI&gt;Label Ext; their name&lt;/LI&gt;&lt;LI&gt;Ledger Ours ;&amp;nbsp; our ledger that belongs their to ledger&lt;/LI&gt;&lt;LI&gt;Share factor ; the percentage that our ledgers belongs to their ledger (it's mostly 1, but sometimes 0.3 for instances we have the salaries in one ledger, but they want have a purchase, sales and administration department ledger so we have to split the salaries values between them)&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I made this DAX formula but the results weren't right. The resulting value of external ledgers, where &amp;lt;1 share factors are applicable, were too high. Additionaly the Total value in the visual didn't match the sum of its parts, but the total value was correct.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Result1 =&lt;/SPAN&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;SUM&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'fctFinance'[Booking value]&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;SPAN&gt;'fctFinance'[Ledger]&lt;/SPAN&gt;&lt;SPAN&gt;)*&lt;/SPAN&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;AVERAGE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'dimLedgerExternal'[Share Factor]&lt;/SPAN&gt;&lt;SPAN&gt;))*-&lt;/SPAN&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Via these formums I came across&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.powerbi.com/t5/Desktop/Grand-Total-of-Measures-doesn-t-match-with-SUM-of-row-values/m-p/145769" target="_blank"&gt;https://community.powerbi.com/t5/Desktop/Grand-Total-of-Measures-doesn-t-match-with-SUM-of-row-values/m-p/145769&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And I made this&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Result2 = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;SUMX&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'fctFinance'&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;SUM&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'fctFinance'[Booking value]&lt;/SPAN&gt;&lt;SPAN&gt;)*&lt;/SPAN&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;AVERAGE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'dimLedgerExternal'[Share Factor]&lt;/SPAN&gt;&lt;SPAN&gt;))*-&lt;/SPAN&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;SPAN&gt;)))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;With this formula the individual ledgers have the correct amount, however now the Total value is wrong.&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;I think the problem lies in the fact that, because neither ledgers are unique, I have to use an aggregate argument in the second part of the formula. It feels like I need something else for a solution, but I can't find what it is.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 17 May 2022 07:02:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-to-calculate-the-result-between-booking-values-and/m-p/2519566#M70169</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-05-17T07:02:07Z</dc:date>
    </item>
    <item>
      <title>Re: DAX formula to calculate the result between booking values and their share</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-to-calculate-the-result-between-booking-values-and/m-p/2520256#M70218</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;please try&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;Result2 =
SUMX (
    'fctFinance',
    - 'fctFinance'[Booking value] * RELATED ( 'dimLedgerExternal'[Share Factor] )
)&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 17 May 2022 10:56:48 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-to-calculate-the-result-between-booking-values-and/m-p/2520256#M70218</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-05-17T10:56:48Z</dc:date>
    </item>
    <item>
      <title>Re: DAX formula to calculate the result between booking values and their share</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-to-calculate-the-result-between-booking-values-and/m-p/2520302#M70220</link>
      <description>&lt;P&gt;Hi, PBI won't accept it because even though there is a relation between the two tables, it won't allow that table as input. When I manually type it, it says: "There is no relation with the existing table in the current context"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Edit: After some reading this is because the RELATED function only allows one to one or one too many relations. And both the LedgerExternal as well as the fctFinance table have a many to many with eachother (because of the share factor)&lt;/P&gt;</description>
      <pubDate>Tue, 17 May 2022 11:18:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-to-calculate-the-result-between-booking-values-and/m-p/2520302#M70220</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-05-17T11:18:38Z</dc:date>
    </item>
    <item>
      <title>Re: DAX formula to calculate the result between booking values and their share</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-to-calculate-the-result-between-booking-values-and/m-p/2520343#M70223</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;BR /&gt;Then this should work&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;Result2 =
SUMX (
    'fctFinance',
    - 'fctFinance'[Booking value]
        * AVERAGEX (
            RELATEDTABLE ( 'dimLedgerExternal' ),
            'dimLedgerExternal'[Share Factor]
        )
)&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 17 May 2022 11:28:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-to-calculate-the-result-between-booking-values-and/m-p/2520343#M70223</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-05-17T11:28:06Z</dc:date>
    </item>
    <item>
      <title>Re: DAX formula to calculate the result between booking values and their share</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-to-calculate-the-result-between-booking-values-and/m-p/2520399#M70227</link>
      <description>&lt;P&gt;Thanks for your quick response.&amp;nbsp;&lt;/P&gt;&lt;P&gt;It works, however it gives the exact same result as my own Result 2&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":grinning_squinting_face:"&gt;😆&lt;/span&gt;&lt;/P&gt;&lt;P&gt;For some reason the total value is wrong&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Result2 =
(SUMX('fctFinance',CALCULATE(SUM('fctFinance'[Booking value])*CALCULATE(AVERAGE('dimLedgerExternal'[Share Factor]))*-1)))&lt;/LI-CODE&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Tue, 17 May 2022 11:44:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-to-calculate-the-result-between-booking-values-and/m-p/2520399#M70227</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-05-17T11:44:43Z</dc:date>
    </item>
    <item>
      <title>Re: DAX formula to calculate the result between booking values and their share</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-to-calculate-the-result-between-booking-values-and/m-p/2520441#M70233</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you share a screenshot of your table visual?&lt;BR /&gt;I have a feeling that this is what you want&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;Result2 =
SUMX (
    CROSSJOIN ( 'fctFinance', 'dimLedger' ),
    - 'fctFinance'[Booking value] * 'dimLedgerExternal'[Share Factor]
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 May 2022 12:04:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-to-calculate-the-result-between-booking-values-and/m-p/2520441#M70233</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-05-17T12:04:23Z</dc:date>
    </item>
    <item>
      <title>Re: DAX formula to calculate the result between booking values and their share</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-to-calculate-the-result-between-booking-values-and/m-p/2535391#M71240</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please try the following formula to recalculate the total value.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Result =
SUMX ( VALUES ( 'fctFinance' ), [Result2] )&lt;/LI-CODE&gt;
&lt;P&gt;or the following formula to replace the total value of [Result2] with the total value of [result1]&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Result =
IF ( ISINSCOPE ( 'fctFinance'[ individual ledgers] ), [Result2], [Result1] )&lt;/LI-CODE&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Community Support Team _ Eason&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jun 2022 06:38:27 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-to-calculate-the-result-between-booking-values-and/m-p/2535391#M71240</guid>
      <dc:creator>v-easonf-msft</dc:creator>
      <dc:date>2022-06-07T06:38:27Z</dc:date>
    </item>
  </channel>
</rss>

