<?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 Cumulative total with a hard twist in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Cumulative-total-with-a-hard-twist/m-p/2734441#M38243</link>
    <description>&lt;P&gt;I am new to powerbi and I am unable to solve this question below. Thank you for looking into my question. I have two year month columns(eg: Mar_2021), one is the start month and the other is the end month. I have to count another column's values for each month and create a running total. The running total should add count for start month and subtract the count for the end month. Example: Let say we have a columns start month, end month, region and sales&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Input table.png" style="width: 679px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/773857i85B806B4D6DE3A64/image-size/large?v=v2&amp;amp;px=999" role="button" title="Input table.png" alt="Input table.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The output should be something like&lt;SPAN&gt;&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="output data.png" style="width: 685px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/773858iDDC198C4C2C2252F/image-size/large?v=v2&amp;amp;px=999" role="button" title="output data.png" alt="output data.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Please let me know if someone have any idea about this. Would really appreciate your answers. Idea for Making this into a waterfall chart would be great. Note: The month column is of text datatype&lt;/P&gt;</description>
    <pubDate>Tue, 30 Aug 2022 07:58:08 GMT</pubDate>
    <dc:creator>Aark</dc:creator>
    <dc:date>2022-08-30T07:58:08Z</dc:date>
    <item>
      <title>Cumulative total with a hard twist</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Cumulative-total-with-a-hard-twist/m-p/2734441#M38243</link>
      <description>&lt;P&gt;I am new to powerbi and I am unable to solve this question below. Thank you for looking into my question. I have two year month columns(eg: Mar_2021), one is the start month and the other is the end month. I have to count another column's values for each month and create a running total. The running total should add count for start month and subtract the count for the end month. Example: Let say we have a columns start month, end month, region and sales&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Input table.png" style="width: 679px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/773857i85B806B4D6DE3A64/image-size/large?v=v2&amp;amp;px=999" role="button" title="Input table.png" alt="Input table.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The output should be something like&lt;SPAN&gt;&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="output data.png" style="width: 685px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/773858iDDC198C4C2C2252F/image-size/large?v=v2&amp;amp;px=999" role="button" title="output data.png" alt="output data.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Please let me know if someone have any idea about this. Would really appreciate your answers. Idea for Making this into a waterfall chart would be great. Note: The month column is of text datatype&lt;/P&gt;</description>
      <pubDate>Tue, 30 Aug 2022 07:58:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Cumulative-total-with-a-hard-twist/m-p/2734441#M38243</guid>
      <dc:creator>Aark</dc:creator>
      <dc:date>2022-08-30T07:58:08Z</dc:date>
    </item>
    <item>
      <title>Re: Cumulative total with a hard twist</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Cumulative-total-with-a-hard-twist/m-p/2734832#M38246</link>
      <description>&lt;P&gt;Try these dax：&lt;/P&gt;&lt;P&gt;&lt;FONT&gt;China Running Total = CALCULATE(SUM('Table'[Sales]),'Table'[Region] = “China”);&lt;BR /&gt;Finland Running Total = CALCULATE(SUM('Table'[Sales]),'Table'[Region] = “Finland”);&lt;BR /&gt;Brazil Running Total = CALCULATE(SUM('Table'[Sales]),'Table'[Region] = “Brazil”);&lt;BR /&gt;Running Total Sales= [China Running Total] + [Finland Running Total] + [Brazil Running Total]&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Aug 2022 09:41:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Cumulative-total-with-a-hard-twist/m-p/2734832#M38246</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-08-30T09:41:40Z</dc:date>
    </item>
    <item>
      <title>Re: Cumulative total with a hard twist</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Cumulative-total-with-a-hard-twist/m-p/2734938#M38247</link>
      <description>&lt;P&gt;Hi. thanks a lot for your suggestion. But doing cumulative sum is not the main problem, subtracting the cumu sum when it ends according to the end date is the problem. I have to take into account both the start date and end date in one column as I have shown in the output table and accordingly add the subtract the sales.&lt;/P&gt;</description>
      <pubDate>Tue, 30 Aug 2022 10:05:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Cumulative-total-with-a-hard-twist/m-p/2734938#M38247</guid>
      <dc:creator>Aark</dc:creator>
      <dc:date>2022-08-30T10:05:32Z</dc:date>
    </item>
    <item>
      <title>Re: Cumulative total with a hard twist</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Cumulative-total-with-a-hard-twist/m-p/2735268#M38251</link>
      <description>&lt;P&gt;Looks like you have overlapping periods per region too.&amp;nbsp; Not clear if the Sales value should be applied for all months in the interval (bar the end month).&amp;nbsp; Please clarify.&lt;/P&gt;</description>
      <pubDate>Tue, 30 Aug 2022 12:50:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Cumulative-total-with-a-hard-twist/m-p/2735268#M38251</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2022-08-30T12:50:12Z</dc:date>
    </item>
    <item>
      <title>Re: Cumulative total with a hard twist</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Cumulative-total-with-a-hard-twist/m-p/2735283#M38253</link>
      <description>&lt;P&gt;Hi, Thanks for your reply. The sales value should increase based on the start month and should decrease based on the end month. For example, for the first row in the input table, for china the sales value increases by 400 on 2021 jan and should decrease by the same 400 for the month of 2022 feb as this is the end month. Hope this clarifies your question a bit. Let me know incase you need more information.&lt;/P&gt;</description>
      <pubDate>Tue, 30 Aug 2022 12:54:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Cumulative-total-with-a-hard-twist/m-p/2735283#M38253</guid>
      <dc:creator>Aark</dc:creator>
      <dc:date>2022-08-30T12:54:40Z</dc:date>
    </item>
    <item>
      <title>Re: Cumulative total with a hard twist</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Cumulative-total-with-a-hard-twist/m-p/2736246#M38261</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMtQ31DcyMDJU0lEygjCNgEznjMy8RCBtYmCgFKsTDZMCqTJEUuaWmZeTmJcCEsWv0KkosSozB0mdJUKdMaa1xnhVIWw1QrUVJGkCYRpjVYdkCMx1xhiuiwUA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Start = _t, End = _t, Region = _t, Sales = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Start", type date}, {"End", type date}, {"Sales", Currency.Type}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Date", (k)=&amp;gt; List.Generate(()=&amp;gt;0,each Date.AddMonths(k[Start],_) &amp;lt; k[End], each _ + 1,each Date.AddMonths(k[Start],_))),
    #"Expanded Dates" = Table.ExpandListColumn(#"Added Custom", "Date"),
    #"Changed Type1" = Table.TransformColumnTypes(#"Expanded Dates",{{"Date", type date}})
in
    #"Changed Type1"&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How to use this code: Create a new Blank Query. Click on "Advanced Editor". Replace the code in the window with the code provided here. Click "Done".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then you can create a matrix visual&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="lbendlin_0-1661888358729.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/774763i784E4C58D055C8F6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="lbendlin_0-1661888358729.png" alt="lbendlin_0-1661888358729.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Note that "running total" generally has a different meaning.&lt;/P&gt;</description>
      <pubDate>Tue, 30 Aug 2022 19:39:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Cumulative-total-with-a-hard-twist/m-p/2736246#M38261</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2022-08-30T19:39:59Z</dc:date>
    </item>
  </channel>
</rss>

