<?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: Help for supply chain minimum quantity requirement in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-for-supply-chain-minimum-quantity-requirement/m-p/4310976#M171209</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Maybe you can try formula like below to create measure:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Deficit = 
VAR CurrentStock =
    CALCULATE (
        SUM ( 'Stock'[Quantity] ),
        'Stock'[Storage Location] = "A01"
    )
VAR MinimumStock =
    LOOKUPVALUE (
        'Mini'[Minimum Quantity],
        'Mini'[Item], MAX ( 'Stock'[Item] )
    )
RETURN
    MAX ( 0, MinimumStock - CurrentStock )
&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;Batches = 
VAR RequiredStock = [Deficit]
VAR BatchTable =
    FILTER (
        'Stock',
        'Stock'[Storage Location] = "A02"
            &amp;amp;&amp;amp; 'Stock'[Item] = MAX(  'Stock'[Item] )
    )
VAR SortedBatchTable =
    ADDCOLUMNS (
        BatchTable,
        "CumulativeStock",
            SUMX (
                FILTER ( BatchTable, [Creation Date] &amp;lt;= EARLIER ([Creation Date] ) ),
                [Quantity]
            )
    )
VAR SelectedBatches =
    CONCATENATEX (
        FILTER ( SortedBatchTable, [CumulativeStock] &amp;lt;= RequiredStock ),
        [Batch],
        "/",
        [Creation Date], ASC
    )
RETURN
    SelectedBatches
&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Adamk Kong&lt;BR /&gt;&lt;BR /&gt;If this post &lt;EM&gt;&lt;STRONG&gt;helps&lt;/STRONG&gt;&lt;/EM&gt;, then please consider &lt;EM&gt;&lt;STRONG&gt;Accept it as the solution&lt;/STRONG&gt;&lt;/EM&gt; to help the other members find it more quickly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 03 Dec 2024 06:21:32 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2024-12-03T06:21:32Z</dc:date>
    <item>
      <title>Help for supply chain minimum quantity requirement</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-for-supply-chain-minimum-quantity-requirement/m-p/4310356#M171175</link>
      <description>&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have some difficulties to create the good formula..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My case is this one :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have some materials which need to have always at a special storage location a minimum of stock quantity (in A01)&lt;/P&gt;&lt;P&gt;If the stock is not covered the minimum quantity. I need to know how many pallets I need toi supply.&lt;/P&gt;&lt;P&gt;When I know how many pallets I need to supply. I check in another storage location how many pallet sI have.&lt;/P&gt;&lt;P&gt;If I have enough quantity in pallet in another storage location, I need to select the batch I need by its oldest creation date (FIFO).&lt;/P&gt;&lt;P&gt;If there are differents lines for the same batch, I just need the batch number. If one batch is not enough to cover my minimum stock, I need to show a 2 batch number until I get enough stock.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For examples in my power BI in attached, for the item 1200952, I have 90 000 pcs in stock in A01 which is not enough because my minimum stock is 145 000 pcs. So I need 55 000 pcs more.&lt;/P&gt;&lt;P&gt;If i check my stock in storage type A02, I see that there is 150 000 pcs.&lt;/P&gt;&lt;P&gt;In the table in my power bi, i can see the details of what I have in stock in A02 per batches.&lt;/P&gt;&lt;P&gt;Here what I would need, it's to show in my first table, in a last column the batches I need to succeed having minimum stock. So it would be batch FA819809/FA819810/ FA819811 in concatenate.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the link of my power bi&lt;/P&gt;&lt;P&gt;&lt;A href="https://we.tl/t-ieAjEqhimo" target="_self"&gt;https://we.tl/t-ieAjEqhimo&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much for your help&lt;/P&gt;&lt;P&gt;Manoli&lt;/P&gt;</description>
      <pubDate>Mon, 02 Dec 2024 19:38:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-for-supply-chain-minimum-quantity-requirement/m-p/4310356#M171175</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-12-02T19:38:42Z</dc:date>
    </item>
    <item>
      <title>Re: Help for supply chain minimum quantity requirement</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-for-supply-chain-minimum-quantity-requirement/m-p/4310614#M171190</link>
      <description>&lt;P&gt;Power BI is a reporting tool. It is not suitable for inventory management. Please use a tool that was specifically designed for that purpose.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Dec 2024 01:34:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-for-supply-chain-minimum-quantity-requirement/m-p/4310614#M171190</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2024-12-03T01:34:47Z</dc:date>
    </item>
    <item>
      <title>Re: Help for supply chain minimum quantity requirement</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-for-supply-chain-minimum-quantity-requirement/m-p/4310958#M171208</link>
      <description>&lt;P&gt;Hello &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;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your answer&lt;/P&gt;&lt;P&gt;I agree with you but I have no choice, asked me to use Power BI..&lt;/P&gt;&lt;P&gt;Manoli&lt;/P&gt;</description>
      <pubDate>Tue, 03 Dec 2024 06:09:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-for-supply-chain-minimum-quantity-requirement/m-p/4310958#M171208</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-12-03T06:09:28Z</dc:date>
    </item>
    <item>
      <title>Re: Help for supply chain minimum quantity requirement</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-for-supply-chain-minimum-quantity-requirement/m-p/4310976#M171209</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Maybe you can try formula like below to create measure:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Deficit = 
VAR CurrentStock =
    CALCULATE (
        SUM ( 'Stock'[Quantity] ),
        'Stock'[Storage Location] = "A01"
    )
VAR MinimumStock =
    LOOKUPVALUE (
        'Mini'[Minimum Quantity],
        'Mini'[Item], MAX ( 'Stock'[Item] )
    )
RETURN
    MAX ( 0, MinimumStock - CurrentStock )
&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;Batches = 
VAR RequiredStock = [Deficit]
VAR BatchTable =
    FILTER (
        'Stock',
        'Stock'[Storage Location] = "A02"
            &amp;amp;&amp;amp; 'Stock'[Item] = MAX(  'Stock'[Item] )
    )
VAR SortedBatchTable =
    ADDCOLUMNS (
        BatchTable,
        "CumulativeStock",
            SUMX (
                FILTER ( BatchTable, [Creation Date] &amp;lt;= EARLIER ([Creation Date] ) ),
                [Quantity]
            )
    )
VAR SelectedBatches =
    CONCATENATEX (
        FILTER ( SortedBatchTable, [CumulativeStock] &amp;lt;= RequiredStock ),
        [Batch],
        "/",
        [Creation Date], ASC
    )
RETURN
    SelectedBatches
&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Adamk Kong&lt;BR /&gt;&lt;BR /&gt;If this post &lt;EM&gt;&lt;STRONG&gt;helps&lt;/STRONG&gt;&lt;/EM&gt;, then please consider &lt;EM&gt;&lt;STRONG&gt;Accept it as the solution&lt;/STRONG&gt;&lt;/EM&gt; to help the other members find it more quickly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Dec 2024 06:21:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-for-supply-chain-minimum-quantity-requirement/m-p/4310976#M171209</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-12-03T06:21:32Z</dc:date>
    </item>
    <item>
      <title>Re: Help for supply chain minimum quantity requirement</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-for-supply-chain-minimum-quantity-requirement/m-p/4312040#M171248</link>
      <description>&lt;P&gt;Hello Adamk&lt;/P&gt;&lt;P&gt;Thank you very much for your proposal!&lt;/P&gt;&lt;P&gt;But I would change the formula like that :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Batches =&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;VAR&lt;/SPAN&gt; &lt;SPAN&gt;RequiredStock&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;[Deficit]&lt;/SPAN&gt;&lt;/DIV&g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t; &lt;SPAN&gt;SortedBatchTable&lt;/SPAN&gt;&lt;SPAN&gt; =&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;ADDCOLUMNS&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;BatchTable&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;"CumulativeStock"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;SUMX&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;FILTER&lt;/SPAN&gt;&lt;SPAN&gt; ( &lt;/SPAN&gt;&lt;SPAN&gt;BatchTable&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;[Creation Date]&lt;/SPAN&gt;&lt;SPAN&gt; &amp;lt;= &lt;/SPAN&gt;&lt;SPAN&gt;EARLIER&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;SPAN&gt;[Creation Date]&lt;/SPAN&gt;&lt;SPAN&gt; ) ),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;[Quantity]&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; )&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; )&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;VAR&lt;/SPAN&gt; &lt;SPAN&gt;SelectedBatches&lt;/SPAN&gt;&lt;SPAN&gt; =&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;CONCATENATEX&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;FILTER&lt;/SPAN&gt;&lt;SPAN&gt; ( &lt;/SPAN&gt;&lt;SPAN&gt;SortedBatchTable&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;[CumulativeStock]&lt;/SPAN&gt;&lt;FONT size="6" color="#0000FF"&gt;&lt;STRONG&gt; &amp;gt;= &lt;/STRONG&gt;&lt;/FONT&gt;&lt;SPAN&gt;RequiredStock&lt;/SPAN&gt;&lt;SPAN&gt; ),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;[Batch]&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;"/"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;[Creation Date]&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;ASC&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; )&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;RETURN&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;SelectedBatches&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Your formula is showing me a quantity of batch quantity which is inferior to my "deficit" and I need the oposite.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;If I change the sign to &amp;gt;= instead of &amp;lt;= the formula does not work complety because I only need to see enough batches by the oldest which can cover at a minimum the quantity in "deficit".&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;So in reality I would need to see batch FA819809 because of his age (03/02/2024) quantity = 45 000 pcs + FA819810 of 5000 pcs (another batch because we miss 10 000 pcs to have get quantity of 55 000 pcs(in deficit) and his age) &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;+ FA819811 (55 000 pcs). So I would need to see FA819809 FA819810 FA819811. In quantity is 60 000 pcs, superior of the deficit of 55 000 pcs&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Do you have another idea ? &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;A href="https://we.tl/t-wDzbSs7qZx" target="_self"&gt;https://we.tl/t-wDzbSs7qZx&lt;/A&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Thank you !&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 03 Dec 2024 17:57:37 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-for-supply-chain-minimum-quantity-requirement/m-p/4312040#M171248</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-12-03T17:57:37Z</dc:date>
    </item>
  </channel>
</rss>

