<?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 Calculate cumulative total by multiplying value to itself. in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-cumulative-total-by-multiplying-value-to-itself/m-p/4685851#M179470</link>
    <description>&lt;P&gt;Hi. Asking for your help on calculating cumulative total by multiplying the average value to itself. I want to achieve the line chart below. My example is Id 1.&lt;BR /&gt;For the data model the relationship of date table to Table 1 is inactive because there is another active relationnship in that table. For the sake of simplicity I just shown how End Date is connected to the date table as well as Start date from another table to the date table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance for your help.&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;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 09 May 2025 06:00:10 GMT</pubDate>
    <dc:creator>third_hicana</dc:creator>
    <dc:date>2025-05-09T06:00:10Z</dc:date>
    <item>
      <title>Calculate cumulative total by multiplying value to itself.</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-cumulative-total-by-multiplying-value-to-itself/m-p/4685851#M179470</link>
      <description>&lt;P&gt;Hi. Asking for your help on calculating cumulative total by multiplying the average value to itself. I want to achieve the line chart below. My example is Id 1.&lt;BR /&gt;For the data model the relationship of date table to Table 1 is inactive because there is another active relationnship in that table. For the sake of simplicity I just shown how End Date is connected to the date table as well as Start date from another table to the date table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance for your help.&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;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 May 2025 06:00:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-cumulative-total-by-multiplying-value-to-itself/m-p/4685851#M179470</guid>
      <dc:creator>third_hicana</dc:creator>
      <dc:date>2025-05-09T06:00:10Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate cumulative total by multiplying value to itself.</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-cumulative-total-by-multiplying-value-to-itself/m-p/4687073#M179512</link>
      <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="424059" data-lia-user-login="third_hicana" class="lia-mention lia-mention-user"&gt;third_hicana&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;Thanks for reaching out to the Microsoft fabric community forum.&lt;/P&gt;
&lt;P data-start="232" data-end="559"&gt;From your model and the chart, the goal is to display a running total where the daily value is calculated by multiplying the "Daily_Average" by the number of days since the Start Date, up until the End Date.&lt;/P&gt;
&lt;P data-start="561" data-end="942"&gt;One key thing to note is the inactive relationship between your Date Table and the End Date in Table 1. Since Power BI only allows one active relationship between two tables at a time, it's defaulting to the active Start Date relationship from Table 2. Because of this, your calculation won’t automatically consider the full range from Start Date to End Date for each ID.&lt;/P&gt;
&lt;P data-start="944" data-end="1032"&gt;To get the cumulative total as shown in your chart (80, 160, 240, etc.), you'll need to create a measure that uses "USERELATIONSHIP()" to activate the connection to End Date when needed. Then filter the dates so that only the ones between Start Date and End Date are included. And then multiply the "Daily_Average" by the number of days since the Start Date (including the current day).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If I misunderstand your needs or you still have problems on it, please feel free to let us know.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Hammad.&lt;BR /&gt;Community Support Team&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post helps then please mark it as a solution, so that other members find it more quickly.&lt;/P&gt;
&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Fri, 09 May 2025 20:19:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-cumulative-total-by-multiplying-value-to-itself/m-p/4687073#M179512</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2025-05-09T20:19:34Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate cumulative total by multiplying value to itself.</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-cumulative-total-by-multiplying-value-to-itself/m-p/4687486#M179518</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Could you give me a dax pattern of your solution please? &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;I tried this one but failed to see the result I am expecting&lt;BR /&gt;&lt;BR /&gt;VAR CurrentDate = MAX(DateTable[Date])&lt;/P&gt;&lt;P&gt;RETURN&lt;BR /&gt;CALCULATE(FILTER(Table2,&amp;nbsp;Table2[StartDate] &amp;lt;= CurrentDate &amp;amp;&amp;amp; RELATED(Table1[EndDate] &amp;gt;= CurrentDate), Table1[Daily_Average] * [NumberOfDays]), USERELATIONSHIP(Table1[EndDate],&amp;nbsp;DateTable[Date]))&lt;/P&gt;</description>
      <pubDate>Sat, 10 May 2025 12:58:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-cumulative-total-by-multiplying-value-to-itself/m-p/4687486#M179518</guid>
      <dc:creator>third_hicana</dc:creator>
      <dc:date>2025-05-10T12:58:50Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate cumulative total by multiplying value to itself.</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-cumulative-total-by-multiplying-value-to-itself/m-p/4687753#M179525</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="424059" data-lia-user-login="third_hicana" class="lia-mention lia-mention-user"&gt;third_hicana&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Please take this below solution..&lt;BR /&gt;Just to add one suggesation.. Always follow below statement&lt;/P&gt;
&lt;P&gt;"&lt;EM&gt;Data should be transformed as far upstream as possible, and as far downstream as necessary."&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;This is not my statement.. This is Maxim law and that should follow every data modellar and&amp;nbsp; BI developer. Just do the simple google search and you will able to understand the significance of this statement.&lt;/P&gt;
&lt;P&gt;Now, come to your solution.. Below is the logic&lt;BR /&gt;1) First, You need to prepare you data.&lt;BR /&gt;2) Second, write a simple cumulative DAX.(NO FANCY DAX)&lt;BR /&gt;For preparing data. follow below m code&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;let
    Source = Table2,
    #"Merged Queries" = Table.NestedJoin(Source, {"ID"}, Table1, {"ID"}, "Table1", JoinKind.LeftOuter),
    #"Expanded Table1" = Table.ExpandTableColumn(#"Merged Queries", "Table1", {"Daily_Average", "End Date"}, {"Daily_Average", "End Date"}),
    #"Added Custom" = Table.AddColumn(#"Expanded Table1", "Date", each List.Dates([Start Date],
Number.From([End Date] - [Start Date] ) + 1,#duration(1,0,0,0)
)),
    #"Expanded Date" = Table.ExpandListColumn(#"Added Custom", "Date"),
    #"Changed Type" = Table.TransformColumnTypes(#"Expanded Date",{{"Date", type date}})
in
    #"Changed Type"&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;2) Use below DAX&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;IF(
 ISBLANK( SUM( 'Table'[Daily_Average] ) ),BLANK(),
CALCULATE(
    SUM( 'Table'[Daily_Average] ),
FILTER(
    ALL( 'Date Table'),
 'Date Table'[Date] &amp;lt;= MAX( 'Date Table'[Date] )
)) )&lt;/LI-CODE&gt;
&lt;P&gt;if you want to show ID wise cumulative then Add VALUES function after the Filter function.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Below screenshot&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Attached the pbix file for your refrence.&lt;BR /&gt;&lt;BR /&gt;Hope it helps&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards&lt;/P&gt;
&lt;P&gt;sanalytics&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 11 May 2025 08:08:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-cumulative-total-by-multiplying-value-to-itself/m-p/4687753#M179525</guid>
      <dc:creator>sanalytics</dc:creator>
      <dc:date>2025-05-11T08:08:13Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate cumulative total by multiplying value to itself.</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-cumulative-total-by-multiplying-value-to-itself/m-p/4691768#M179661</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="195725" data-lia-user-login="sanalytics" class="lia-mention lia-mention-user"&gt;sanalytics&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much for your help. This works for me.&lt;/P&gt;</description>
      <pubDate>Wed, 14 May 2025 05:32:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-cumulative-total-by-multiplying-value-to-itself/m-p/4691768#M179661</guid>
      <dc:creator>third_hicana</dc:creator>
      <dc:date>2025-05-14T05:32:03Z</dc:date>
    </item>
  </channel>
</rss>

