<?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 DAX Carton Backlog Calculation with maximum Capacity per Day in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Carton-Backlog-Calculation-with-maximum-Capacity-per-Day/m-p/4587498#M175738</link>
    <description>&lt;P&gt;Hi Guys,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I struggle for a while with this topic now, if it is even possible to calculate in Power BI.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The situation:&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a table with a carton quantity per Date. Each day there is a restriction on how many cartons can be processed (e.g. 100 cartons). If there are more cartons than can be processed, the quantity is taken to the next day. Having this backlog for one day, is no problem, but this scenario can happen multiple days in a row. Adding new backlog each day, that will be processed once the "new cartons" are below our maximum capacity.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Date&lt;/TD&gt;&lt;TD&gt;Cartons Incoming&lt;/TD&gt;&lt;TD&gt;Cartons Processed&lt;/TD&gt;&lt;TD&gt;Cartons Backlog&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;90&lt;/TD&gt;&lt;TD&gt;90&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;110&lt;/TD&gt;&lt;TD&gt;100&lt;/TD&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;130&lt;/TD&gt;&lt;TD&gt;100&lt;/TD&gt;&lt;TD&gt;40&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;105&lt;/TD&gt;&lt;TD&gt;100&lt;/TD&gt;&lt;TD&gt;45&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;95&lt;/TD&gt;&lt;TD&gt;100&lt;/TD&gt;&lt;TD&gt;40&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;6&lt;/TD&gt;&lt;TD&gt;50&lt;/TD&gt;&lt;TD&gt;90&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In Excel it is easy, as I can simply sum for the processed Cartons: MIN( 100, "Today Cartons Incoming" +&amp;nbsp; "Yesterday Cartons Backlog") and Backlog :&amp;nbsp;"Today Cartons Incoming" +&amp;nbsp; "Yesterday Cartons Backlog" - Today Processed&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but in DAX I am currently not able to exit my current mode of thinking.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let me know, if you need more details and thanks for your help.&lt;/P&gt;</description>
    <pubDate>Thu, 27 Feb 2025 08:41:49 GMT</pubDate>
    <dc:creator>arvbot_LE</dc:creator>
    <dc:date>2025-02-27T08:41:49Z</dc:date>
    <item>
      <title>DAX Carton Backlog Calculation with maximum Capacity per Day</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Carton-Backlog-Calculation-with-maximum-Capacity-per-Day/m-p/4587498#M175738</link>
      <description>&lt;P&gt;Hi Guys,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I struggle for a while with this topic now, if it is even possible to calculate in Power BI.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The situation:&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a table with a carton quantity per Date. Each day there is a restriction on how many cartons can be processed (e.g. 100 cartons). If there are more cartons than can be processed, the quantity is taken to the next day. Having this backlog for one day, is no problem, but this scenario can happen multiple days in a row. Adding new backlog each day, that will be processed once the "new cartons" are below our maximum capacity.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Date&lt;/TD&gt;&lt;TD&gt;Cartons Incoming&lt;/TD&gt;&lt;TD&gt;Cartons Processed&lt;/TD&gt;&lt;TD&gt;Cartons Backlog&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;90&lt;/TD&gt;&lt;TD&gt;90&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;110&lt;/TD&gt;&lt;TD&gt;100&lt;/TD&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;130&lt;/TD&gt;&lt;TD&gt;100&lt;/TD&gt;&lt;TD&gt;40&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;105&lt;/TD&gt;&lt;TD&gt;100&lt;/TD&gt;&lt;TD&gt;45&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;95&lt;/TD&gt;&lt;TD&gt;100&lt;/TD&gt;&lt;TD&gt;40&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;6&lt;/TD&gt;&lt;TD&gt;50&lt;/TD&gt;&lt;TD&gt;90&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In Excel it is easy, as I can simply sum for the processed Cartons: MIN( 100, "Today Cartons Incoming" +&amp;nbsp; "Yesterday Cartons Backlog") and Backlog :&amp;nbsp;"Today Cartons Incoming" +&amp;nbsp; "Yesterday Cartons Backlog" - Today Processed&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but in DAX I am currently not able to exit my current mode of thinking.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let me know, if you need more details and thanks for your help.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Feb 2025 08:41:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Carton-Backlog-Calculation-with-maximum-Capacity-per-Day/m-p/4587498#M175738</guid>
      <dc:creator>arvbot_LE</dc:creator>
      <dc:date>2025-02-27T08:41:49Z</dc:date>
    </item>
    <item>
      <title>Re: DAX Carton Backlog Calculation with maximum Capacity per Day</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Carton-Backlog-Calculation-with-maximum-Capacity-per-Day/m-p/4587611#M175740</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="318715" data-lia-user-login="arvbot_LE" class="lia-mention lia-mention-user"&gt;arvbot_LE&lt;/a&gt;&amp;nbsp;Create a calculated column for the daily processed cartons:&lt;/P&gt;
&lt;P&gt;Cartons Processed = &lt;BR /&gt;VAR MaxCapacity = 100&lt;BR /&gt;VAR IncomingCartons = 'Table'[Cartons Incoming]&lt;BR /&gt;VAR PreviousBacklog = &lt;BR /&gt;CALCULATE(&lt;BR /&gt;SUM('Table'[Cartons Backlog]),&lt;BR /&gt;FILTER(&lt;BR /&gt;'Table',&lt;BR /&gt;'Table'[Date] = EARLIER('Table'[Date]) - 1&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;RETURN&lt;BR /&gt;MIN(MaxCapacity, IncomingCartons + COALESCE(PreviousBacklog, 0))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Create a calculated column for the daily backlog:&lt;/P&gt;
&lt;P&gt;Cartons Backlog = &lt;BR /&gt;VAR MaxCapacity = 100&lt;BR /&gt;VAR IncomingCartons = 'Table'[Cartons Incoming]&lt;BR /&gt;VAR PreviousBacklog = &lt;BR /&gt;CALCULATE(&lt;BR /&gt;SUM('Table'[Cartons Backlog]),&lt;BR /&gt;FILTER(&lt;BR /&gt;'Table',&lt;BR /&gt;'Table'[Date] = EARLIER('Table'[Date]) - 1&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;VAR ProcessedCartons = &lt;BR /&gt;MIN(MaxCapacity, IncomingCartons + COALESCE(PreviousBacklog, 0))&lt;BR /&gt;RETURN&lt;BR /&gt;IncomingCartons + COALESCE(PreviousBacklog, 0) - ProcessedCartons&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Feb 2025 09:41:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Carton-Backlog-Calculation-with-maximum-Capacity-per-Day/m-p/4587611#M175740</guid>
      <dc:creator>bhanu_gautam</dc:creator>
      <dc:date>2025-02-27T09:41:17Z</dc:date>
    </item>
    <item>
      <title>Re: DAX Carton Backlog Calculation with maximum Capacity per Day</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Carton-Backlog-Calculation-with-maximum-Capacity-per-Day/m-p/4587755#M175750</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="625922" data-lia-user-login="bhanu_gautam" class="lia-mention lia-mention-user"&gt;bhanu_gautam&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the quick reply. I tried to implement these formulas. I understand mostly what you have written (never used COALESCE before) and are similar to what I tried so far.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Unfortunatly I do have a problem with the Carton backlog. In the variable for previous_backlog: I can't reference on the formula I am currently writing, so I exchanged it with the daily backlog, as I hadn't a better idea. For periods with 1 day backlog it works,&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but the&amp;nbsp;sample dataset below; I did the calculation by hand for comparison, this does not work properly now&lt;/P&gt;&lt;P&gt;sorry for the messy order of columns &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;I really apprechiate your experience.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And it is possible that my approach is too complicated...&lt;/P&gt;&lt;P&gt;In the end I am looking for a stacked column chart, X axis as Date and as values once the processed cartons (today incoming + everything that could not be processed till this day) and second the total backlog I have left after what I processed today.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Feb 2025 11:17:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Carton-Backlog-Calculation-with-maximum-Capacity-per-Day/m-p/4587755#M175750</guid>
      <dc:creator>arvbot_LE</dc:creator>
      <dc:date>2025-02-27T11:17:40Z</dc:date>
    </item>
    <item>
      <title>Re: DAX Carton Backlog Calculation with maximum Capacity per Day</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Carton-Backlog-Calculation-with-maximum-Capacity-per-Day/m-p/4589378#M175801</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="318715" data-lia-user-login="arvbot_LE" class="lia-mention lia-mention-user"&gt;arvbot_LE&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Based on your description, I created the following dataset:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Create the following two measures:&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure = 
VAR _a = SUM('Table'[Cartons Incoming])
VAR _b = SUM('Table'[Cartons Processed])
VAR _c = _a -_b
RETURN _c&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;Measure 2 = CALCULATE([Measure],ALLSELECTED('Table'),'Table'[Date]&amp;lt;=SELECTEDVALUE('Table'[Date]))&lt;/LI-CODE&gt;
&lt;P&gt;&lt;SPAN&gt;Here are the results:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin-bottom: 6.0pt;"&gt;&lt;SPAN&gt;Best Regards&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin-bottom: 6.0pt;"&gt;&lt;SPAN&gt;Jianpeng &lt;/SPAN&gt;&lt;SPAN&gt;Li&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin-bottom: 6.0pt;"&gt;&lt;SPAN&gt;If this post &lt;STRONG&gt;&lt;I&gt;helps&lt;/I&gt;&lt;/STRONG&gt;, then please consider &lt;STRONG&gt;&lt;I&gt;Accept it as the solution&lt;/I&gt;&lt;/STRONG&gt;&amp;nbsp;to help the other members find it more quickly.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Feb 2025 05:57:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Carton-Backlog-Calculation-with-maximum-Capacity-per-Day/m-p/4589378#M175801</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2025-02-28T05:57:03Z</dc:date>
    </item>
    <item>
      <title>Re: DAX Carton Backlog Calculation with maximum Capacity per Day</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Carton-Backlog-Calculation-with-maximum-Capacity-per-Day/m-p/4596045#M175996</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;this is the "easy" approach, which I have already in place, but does not solve my issue.&lt;/P&gt;&lt;P&gt;My issue is, that my cartons processed is not a given number. It is dependent on my incoming cartons of each day and the backlog of cartons from all days before.&amp;nbsp;&lt;/P&gt;&lt;P&gt;It is a recursion, which I assume is not possible in DAX, but maybe ...&lt;/P&gt;</description>
      <pubDate>Wed, 05 Mar 2025 06:45:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Carton-Backlog-Calculation-with-maximum-Capacity-per-Day/m-p/4596045#M175996</guid>
      <dc:creator>arvbot_LE</dc:creator>
      <dc:date>2025-03-05T06:45:12Z</dc:date>
    </item>
    <item>
      <title>Re: DAX Carton Backlog Calculation with maximum Capacity per Day</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Carton-Backlog-Calculation-with-maximum-Capacity-per-Day/m-p/4596179#M176000</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="318715" data-lia-user-login="arvbot_LE" class="lia-mention lia-mention-user"&gt;arvbot_LE&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Please try below mention measures&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;day backlog = 
 var left_cartons = sum('Table'[Cartons incoming])-sum('Table'[Cartons Processed])
 RETURN
 IF(left_cartons&amp;lt;0,0,left_cartons)&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;Cartons backlog = 
SUMX(
    FILTER(ALL('Table'[Date],'Table'[Cartons incoming],'Table'[Cartons Processed]),'Table'[Date]&amp;lt;=MIN('Table'[Date])),
    var incoming = 'Table'[Cartons incoming]
    var processed =  'Table'[Cartons Processed]
    var result = incoming-processed
    RETURN result)&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Dangar&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;helps&lt;/STRONG&gt;&lt;/EM&gt;, then please consider&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;Accept it as the solution&lt;/STRONG&gt;&lt;/EM&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;to help the other members find it more quickly.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Mar 2025 07:50:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Carton-Backlog-Calculation-with-maximum-Capacity-per-Day/m-p/4596179#M176000</guid>
      <dc:creator>Dangar332</dc:creator>
      <dc:date>2025-03-05T07:50:26Z</dc:date>
    </item>
  </channel>
</rss>

