<?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: Use previous row result as base of calculation in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Use-previous-row-result-as-base-of-calculation/m-p/3764121#M146892</link>
    <description>&lt;P&gt;This is impossible to do in standard DAX as it has no concept of a modifiable aggregator.&amp;nbsp; It can be done in Power Query via List.Accumulate.&amp;nbsp; It should also be possible with the new "Visual Calculations"&amp;nbsp; that run on the visual level and can reference "PREVIOUS"&amp;nbsp; rows or columns.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please provide sample data that covers your issue or question &lt;STRONG&gt;completely&lt;/STRONG&gt;, in a &lt;STRONG&gt;usable&lt;/STRONG&gt; format (not as a screenshot).&lt;BR /&gt;&lt;BR /&gt;Do not include sensitive information or anything not related to the issue or question. &lt;BR /&gt;&lt;BR /&gt;If you are unsure how to upload data please refer to &lt;A href="https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216" target="_blank"&gt;https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216&lt;/A&gt; &lt;BR /&gt;&lt;BR /&gt;Please show the expected outcome based on the sample data you provided. &lt;BR /&gt;&lt;BR /&gt;Want faster answers? &lt;A href="https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523" target="_blank"&gt;https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 14 Mar 2024 16:54:24 GMT</pubDate>
    <dc:creator>lbendlin</dc:creator>
    <dc:date>2024-03-14T16:54:24Z</dc:date>
    <item>
      <title>Use previous row result as base of calculation</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Use-previous-row-result-as-base-of-calculation/m-p/3762270#M146800</link>
      <description>&lt;P&gt;Hello folks !&lt;/P&gt;&lt;P&gt;I hope you are doing well&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":beaming_face_with_smiling_eyes:"&gt;😁&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm developping a tool on PBI to calculate a projected stock, i'm really blocked with the formula &amp;amp; DAX command.&lt;/P&gt;&lt;P&gt;Basicly i use the month stock of my clients to calculate their needs and i do a simulation with my shipping plan.&lt;/P&gt;&lt;P&gt;Here my draft :&lt;/P&gt;&lt;P&gt;Basicly to calculate the projected stock i do :&lt;/P&gt;&lt;LI-CODE lang="c"&gt;Projected Stock = [Stock] + [Inbound M-1] - [2024+%]&lt;/LI-CODE&gt;&lt;P&gt;&lt;STRONG&gt;[Stock]&lt;/STRONG&gt; is the declared stock by the client and its blank if we don't have the data&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;[Inbound M-1]&lt;/STRONG&gt; is the entering stock to the client warehouse&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;[2024+%]&lt;/STRONG&gt; is the sell-out of my client with a % of depletion&lt;/P&gt;&lt;P&gt;All the rows are diferents mesures coming from a data base and converted to the same unit.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;What I want to do is that if my [Stock] = blank(), I use the previous result of the projected stock as [Stock] to simulate the new projected stock for the next month and do it recursively.&lt;/P&gt;&lt;P&gt;I hope you'll understand my problem and try to help me.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The column "Test2" its my tentative and its working for march but not for the other months, here my code :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;Test 2 = if([Stock]=BLANK(),
var _step1 = [Projected Stock M-1]+[Cumul inbound M-1] - [Cumul 2024 + %]
var _step2 = if([Projected Stock M-1]=BLANK(),_step1+[Cumul Stock]+ [Cumul inbound M-1] - [CA 2024 + DEPLETION],_step1)
return _step2,[Projected Stock])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks to all who will take the time to help a Beginner !&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards !&lt;/P&gt;</description>
      <pubDate>Thu, 14 Mar 2024 04:58:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Use-previous-row-result-as-base-of-calculation/m-p/3762270#M146800</guid>
      <dc:creator>Beginer007</dc:creator>
      <dc:date>2024-03-14T04:58:24Z</dc:date>
    </item>
    <item>
      <title>Re: Use previous row result as base of calculation</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Use-previous-row-result-as-base-of-calculation/m-p/3764121#M146892</link>
      <description>&lt;P&gt;This is impossible to do in standard DAX as it has no concept of a modifiable aggregator.&amp;nbsp; It can be done in Power Query via List.Accumulate.&amp;nbsp; It should also be possible with the new "Visual Calculations"&amp;nbsp; that run on the visual level and can reference "PREVIOUS"&amp;nbsp; rows or columns.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please provide sample data that covers your issue or question &lt;STRONG&gt;completely&lt;/STRONG&gt;, in a &lt;STRONG&gt;usable&lt;/STRONG&gt; format (not as a screenshot).&lt;BR /&gt;&lt;BR /&gt;Do not include sensitive information or anything not related to the issue or question. &lt;BR /&gt;&lt;BR /&gt;If you are unsure how to upload data please refer to &lt;A href="https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216" target="_blank"&gt;https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216&lt;/A&gt; &lt;BR /&gt;&lt;BR /&gt;Please show the expected outcome based on the sample data you provided. &lt;BR /&gt;&lt;BR /&gt;Want faster answers? &lt;A href="https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523" target="_blank"&gt;https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Mar 2024 16:54:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Use-previous-row-result-as-base-of-calculation/m-p/3764121#M146892</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2024-03-14T16:54:24Z</dc:date>
    </item>
  </channel>
</rss>

