<?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: Formula for total calculation in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Formula-for-total-calculation/m-p/1690433#M34751</link>
    <description>&lt;P&gt;Can you share some sample data of your tables with expected outcomes. Should be a quick fix.&lt;/P&gt;</description>
    <pubDate>Thu, 25 Feb 2021 19:40:19 GMT</pubDate>
    <dc:creator>stevedep</dc:creator>
    <dc:date>2021-02-25T19:40:19Z</dc:date>
    <item>
      <title>Formula for total calculation</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Formula-for-total-calculation/m-p/1690018#M34732</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am having an issue, tried a lot, but cannot get a solution. This is the situation:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There are two tables.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- One table with Investments and periods, columns: InvestmentID - Start date - End Date - Start value - End value&lt;/P&gt;&lt;P&gt;- One table with Cashflow looking like this: InvestmentID - Cashflow type - Value - Start Date - End Date&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;These two tables are linked so that I can create the following formula:&lt;/P&gt;&lt;P&gt;(SUM(end value) - SUM(start value) - (Cashflow values) / SUM(start value) + SUM(Weighted Cashflow values)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So far so good. This formula calculates the return per investment per period. The next step is linking de returns to get a time weighted return. This is done by adding 1 to the returns, take the product of returns +1, and lastly minus 1. I made this formula: PRODUCTX(Table, (Return+1))-1.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This also works fine but only on investment level. When I want to calculate the time weighted return of multiple investments it goes wrong because my formula takes the product of all the returns in stead of the subtotals. Example:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Investment 1&lt;/P&gt;&lt;P&gt;Q1: 2%&lt;/P&gt;&lt;P&gt;Q2: 3%&lt;/P&gt;&lt;P&gt;Q3: 1.5%&lt;/P&gt;&lt;P&gt;Q4: 5%&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Time weighted return = (1.02 * 1.03 * 1.015 * 1.05) -1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Investment 2&lt;/P&gt;&lt;P&gt;Q1: 1.5%&lt;/P&gt;&lt;P&gt;Q2: 2%&lt;/P&gt;&lt;P&gt;Q3: 4%&lt;/P&gt;&lt;P&gt;Q4: 3%&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Time weighted return = (1.015 * 1.02 * 1.04 * 1.03) -1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But when I want to calculate the time weighted return of both investments this is what needs to happen:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Result when I create a table with a filter on 2 investments: (Calculation of return works fine for multiple investments)&lt;/P&gt;&lt;P&gt;Investment 1&amp;amp;2&lt;/P&gt;&lt;P&gt;Q1: 3%&lt;/P&gt;&lt;P&gt;Q2: 1.6%&lt;/P&gt;&lt;P&gt;Q3: 2.8%&lt;/P&gt;&lt;P&gt;Q4: 3.8%&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Time weighted return: (1.03 * 1.016 * 1.028 * 1.038) -1&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But when I use this formula:&amp;nbsp;PRODUCTX(Table, (Return+1))-1, PowerBI multiplies all individual returns of investment 1 and 2. What is the result?&amp;nbsp;(1.02 * 1.03 * 1.015 * 1.05 * 1.015 * 1.02 * 1.04 * 1.03) -1. This is the wrong result.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does anyone have an idea how to solve this? Below I posted a screenshot to visualize things; the outcome of the desired formula should be: (1.0278 * 1.0158 * 1.0167 * 1.1053) -1 = &lt;STRONG&gt;17.32%&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Can someone help me? I am stuck now for 3 days on this issue. &lt;/STRONG&gt;&lt;/P&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&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>Thu, 25 Feb 2021 15:37:55 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Formula-for-total-calculation/m-p/1690018#M34732</guid>
      <dc:creator>TeunVerhagen</dc:creator>
      <dc:date>2021-02-25T15:37:55Z</dc:date>
    </item>
    <item>
      <title>Re: Formula for total calculation</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Formula-for-total-calculation/m-p/1690433#M34751</link>
      <description>&lt;P&gt;Can you share some sample data of your tables with expected outcomes. Should be a quick fix.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Feb 2021 19:40:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Formula-for-total-calculation/m-p/1690433#M34751</guid>
      <dc:creator>stevedep</dc:creator>
      <dc:date>2021-02-25T19:40:19Z</dc:date>
    </item>
    <item>
      <title>Re: Formula for total calculation</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Formula-for-total-calculation/m-p/1691770#M34784</link>
      <description>&lt;P&gt;Thanks for your reply!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have made an Excel with sample data and a PowerBI file but I can't share it in this forum for some reason.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there another way to send you the files?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;Teun&lt;/P&gt;</description>
      <pubDate>Fri, 26 Feb 2021 09:51:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Formula-for-total-calculation/m-p/1691770#M34784</guid>
      <dc:creator>TeunVerhagen</dc:creator>
      <dc:date>2021-02-26T09:51:19Z</dc:date>
    </item>
    <item>
      <title>Re: Formula for total calculation</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Formula-for-total-calculation/m-p/1691927#M34788</link>
      <description>&lt;P&gt;Via a PM is fine.&lt;/P&gt;</description>
      <pubDate>Fri, 26 Feb 2021 11:02:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Formula-for-total-calculation/m-p/1691927#M34788</guid>
      <dc:creator>stevedep</dc:creator>
      <dc:date>2021-02-26T11:02:26Z</dc:date>
    </item>
    <item>
      <title>Re: Formula for total calculation</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Formula-for-total-calculation/m-p/1697523#M34943</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="225476" data-lia-user-login="TeunVerhagen" class="lia-mention lia-mention-user"&gt;TeunVerhagen&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In this case its required to set the right level of aggregation in the productx command. Productx takes a table as a parameter. By giving a table on the level of period you will get the right results.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Modified Dietz = PRODUCTX(SUMMARIZE('NAV Dietz Table','NAV Dietz Table'[NAV Date Start],'NAV Dietz Table'[NAV Date End]),ROUND([Dietz]+1,2))-1&lt;/LI-CODE&gt;
&lt;P&gt;Kind regards, Steve.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Mar 2021 06:18:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Formula-for-total-calculation/m-p/1697523#M34943</guid>
      <dc:creator>stevedep</dc:creator>
      <dc:date>2021-03-02T06:18:38Z</dc:date>
    </item>
  </channel>
</rss>

