<?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 Iterative Calculation Over Time in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Iterative-Calculation-Over-Time/m-p/2359560#M60241</link>
    <description>&lt;P&gt;Iterative Calculation&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hello all!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I could use some help with doing a calculation which I believe will end up being iterative.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the table below, I would like to populate the count column (or a new column being that it’s a calculation) that takes the previous months (count * retention) + close_count&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;&lt;P&gt;I am able to easily do this in excel but am not sure how to execute this in DAX.&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;&lt;P&gt;I have included a project file for reference.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any assistance with this would be greatly appreciated!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;File: &lt;A href="https://www.dropbox.com/s/p7yp3u066a1owu4/power_bi_example.pbix?dl=0" target="_blank"&gt;https://www.dropbox.com/s/p7yp3u066a1owu4/power_bi_example.pbix?dl=0&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 24 Feb 2022 19:26:34 GMT</pubDate>
    <dc:creator>arhomberg</dc:creator>
    <dc:date>2022-02-24T19:26:34Z</dc:date>
    <item>
      <title>Iterative Calculation Over Time</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Iterative-Calculation-Over-Time/m-p/2359560#M60241</link>
      <description>&lt;P&gt;Iterative Calculation&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hello all!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I could use some help with doing a calculation which I believe will end up being iterative.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the table below, I would like to populate the count column (or a new column being that it’s a calculation) that takes the previous months (count * retention) + close_count&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;&lt;P&gt;I am able to easily do this in excel but am not sure how to execute this in DAX.&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;&lt;P&gt;I have included a project file for reference.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any assistance with this would be greatly appreciated!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;File: &lt;A href="https://www.dropbox.com/s/p7yp3u066a1owu4/power_bi_example.pbix?dl=0" target="_blank"&gt;https://www.dropbox.com/s/p7yp3u066a1owu4/power_bi_example.pbix?dl=0&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Feb 2022 19:26:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Iterative-Calculation-Over-Time/m-p/2359560#M60241</guid>
      <dc:creator>arhomberg</dc:creator>
      <dc:date>2022-02-24T19:26:34Z</dc:date>
    </item>
    <item>
      <title>Re: Iterative Calculation Over Time</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Iterative-Calculation-Over-Time/m-p/2362063#M60398</link>
      <description>&lt;P&gt;Thank you for providing sample data.&amp;nbsp; (Next time please sanitize it)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is impossible to do in Power BI DAX but relatively easy to achieve in Power Query M.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("dc67DcAwCATQXagtzOH4wyyR918jTuMkKDRc8Q7EeZJoFmRVSqRsuGP0NYXNaKZVKE8B3GTlh4/NXmoobQuEUT3310vDvI7wrG0RbsUpJNoDQtFfmRc=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [fulldate = _t, close_count = _t, count = _t, retention = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"fulldate", type date}, {"close_count", type number}, {"count", type number}, {"retention", type number}}),
    #"Replaced Value" = Table.ReplaceValue(#"Changed Type",null,0,Replacer.ReplaceValue,{"close_count"}),
    #"Added Index" = Table.AddIndexColumn(#"Replaced Value", "Index", 0, 1, Int64.Type),
    #"Added Custom" = Table.AddColumn(#"Added Index", "Count2", each List.Accumulate({1..[Index]},287,(state,current)=&amp;gt; state * #"Added Index"{current-1}[retention] + #"Added Index"{current-1}[close_count]))
in
    #"Added Custom"&lt;/LI-CODE&gt;
&lt;H5&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;/H5&gt;</description>
      <pubDate>Sat, 26 Feb 2022 00:40:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Iterative-Calculation-Over-Time/m-p/2362063#M60398</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2022-02-26T00:40:46Z</dc:date>
    </item>
    <item>
      <title>Re: Iterative Calculation Over Time</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Iterative-Calculation-Over-Time/m-p/2364977#M60521</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="100342" data-lia-user-login="lbendlin" class="lia-mention lia-mention-user"&gt;lbendlin&lt;/a&gt;Thanks for the assistance with this, it is greatly appreciated!&lt;/P&gt;</description>
      <pubDate>Mon, 28 Feb 2022 15:11:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Iterative-Calculation-Over-Time/m-p/2364977#M60521</guid>
      <dc:creator>arhomberg</dc:creator>
      <dc:date>2022-02-28T15:11:20Z</dc:date>
    </item>
    <item>
      <title>Re: Iterative Calculation Over Time</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Iterative-Calculation-Over-Time/m-p/2365686#M60553</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="100342" data-lia-user-login="lbendlin" class="lia-mention lia-mention-user"&gt;lbendlin&lt;/a&gt;As a follow-up, I see that you have the value 287 hard coded in. Is it possible to select the value in the first row of the 'count' colum instead?&lt;/P&gt;</description>
      <pubDate>Mon, 28 Feb 2022 22:05:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Iterative-Calculation-Over-Time/m-p/2365686#M60553</guid>
      <dc:creator>arhomberg</dc:creator>
      <dc:date>2022-02-28T22:05:19Z</dc:date>
    </item>
    <item>
      <title>Re: Iterative Calculation Over Time</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Iterative-Calculation-Over-Time/m-p/2365725#M60555</link>
      <description>&lt;P&gt;sure&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("dc67DcAwCATQXagtzOH4wyyR918jTuMkKDRc8Q7EeZJoFmRVSqRsuGP0NYXNaKZVKE8B3GTlh4/NXmoobQuEUT3310vDvI7wrG0RbsUpJNoDQtFfmRc=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [fulldate = _t, close_count = _t, count = _t, retention = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"fulldate", type date}, {"close_count", type number}, {"count", type number}, {"retention", type number}}),
    #"Replaced Value" = Table.ReplaceValue(#"Changed Type",null,0,Replacer.ReplaceValue,{"close_count"}),
    #"Added Index" = Table.AddIndexColumn(#"Replaced Value", "Index", 0, 1, Int64.Type),
    #"Added Custom" = Table.AddColumn(#"Added Index", "Count2", each List.Accumulate({1..[Index]},#"Added Index"{0}[count],(state,current)=&amp;gt; state * #"Added Index"{current-1}[retention] + #"Added Index"{current-1}[close_count]))
in
    #"Added Custom"&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 28 Feb 2022 22:28:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Iterative-Calculation-Over-Time/m-p/2365725#M60555</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2022-02-28T22:28:00Z</dc:date>
    </item>
    <item>
      <title>Re: Iterative Calculation Over Time</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Iterative-Calculation-Over-Time/m-p/2365729#M60556</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="100342" data-lia-user-login="lbendlin" class="lia-mention lia-mention-user"&gt;lbendlin&lt;/a&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Mon, 28 Feb 2022 22:30:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Iterative-Calculation-Over-Time/m-p/2365729#M60556</guid>
      <dc:creator>arhomberg</dc:creator>
      <dc:date>2022-02-28T22:30:06Z</dc:date>
    </item>
  </channel>
</rss>

