<?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 Min Posting Date - Total qty of 3 or more in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Min-Posting-Date-Total-qty-of-3-or-more/m-p/3580657#M138105</link>
    <description>&lt;P&gt;Hi Community!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anyone help me with a DAX formula to reflect:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If total qty is equal to or greater than 3 then show minimum posting date.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ex:&lt;/P&gt;&lt;P&gt;Invoice #:&amp;nbsp; &amp;nbsp; Posting Date:&amp;nbsp; &amp;nbsp; &amp;nbsp; Qty:&amp;nbsp;&lt;/P&gt;&lt;P&gt;A&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;9/1/23&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2&lt;/P&gt;&lt;P&gt;B&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;10/5/23&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In this case, I want the formula to return 10/5/23 as 2 + 1 = 3 (minimum qty threshold)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;Christina&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 12 Dec 2023 22:14:46 GMT</pubDate>
    <dc:creator>christina4444</dc:creator>
    <dc:date>2023-12-12T22:14:46Z</dc:date>
    <item>
      <title>Min Posting Date - Total qty of 3 or more</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Min-Posting-Date-Total-qty-of-3-or-more/m-p/3580657#M138105</link>
      <description>&lt;P&gt;Hi Community!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anyone help me with a DAX formula to reflect:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If total qty is equal to or greater than 3 then show minimum posting date.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ex:&lt;/P&gt;&lt;P&gt;Invoice #:&amp;nbsp; &amp;nbsp; Posting Date:&amp;nbsp; &amp;nbsp; &amp;nbsp; Qty:&amp;nbsp;&lt;/P&gt;&lt;P&gt;A&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;9/1/23&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2&lt;/P&gt;&lt;P&gt;B&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;10/5/23&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In this case, I want the formula to return 10/5/23 as 2 + 1 = 3 (minimum qty threshold)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;Christina&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Dec 2023 22:14:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Min-Posting-Date-Total-qty-of-3-or-more/m-p/3580657#M138105</guid>
      <dc:creator>christina4444</dc:creator>
      <dc:date>2023-12-12T22:14:46Z</dc:date>
    </item>
    <item>
      <title>Re: Min Posting Date - Total qty of 3 or more</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Min-Posting-Date-Total-qty-of-3-or-more/m-p/3581045#M138129</link>
      <description>&lt;P&gt;Hi, I am not sure how your semantic model looks like, but I tried to create a sample pbix file like below.&lt;/P&gt;
&lt;P&gt;Please check the below picture and the attached pbix file.&lt;/P&gt;
&lt;P&gt;I hope the below can provide some ideas on how to create a solution for your semantic model.&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;&lt;A href="https://learn.microsoft.com/en-us/dax/window-function-dax?wt.mc_id=DP-MVP-5004989" target="_blank"&gt;WINDOW function (DAX) - DAX | Microsoft Learn&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Expected result measure: = 
VAR _t =
    ADDCOLUMNS (
        SUMMARIZE (
            ALL ( data ),
            data[Group],
            data[Invoice_number],
            data[posting_date],
            data[Qty]
        ),
        "@runningtotalbygroup",
            CALCULATE (
                SUM ( data[Qty] ),
                WINDOW (
                    1,
                    ABS,
                    0,
                    REL,
                    SUMMARIZE (
                        ALL ( data ),
                        data[Group],
                        data[Invoice_number],
                        data[posting_date],
                        data[Qty]
                    ),
                    ORDERBY ( data[posting_date], ASC ),
                    ,
                    PARTITIONBY ( data[Group] ),
                    MATCHBY ( data[Group], data[posting_date], data[Invoice_number] )
                )
            )
    )
VAR _condition =
    FILTER ( _t, data[Group] = MAX ( data[Group] ) &amp;amp;&amp;amp; [@runningtotalbygroup] &amp;gt;= 3 )
VAR _startdate =
    MINX ( _condition, data[posting_date] )
RETURN
    _startdate&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2023 04:06:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Min-Posting-Date-Total-qty-of-3-or-more/m-p/3581045#M138129</guid>
      <dc:creator>Jihwan_Kim</dc:creator>
      <dc:date>2023-12-13T04:06:50Z</dc:date>
    </item>
    <item>
      <title>Re: Min Posting Date - Total qty of 3 or more</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Min-Posting-Date-Total-qty-of-3-or-more/m-p/3582186#M138191</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="291628" data-lia-user-login="Jihwan_Kim" class="lia-mention lia-mention-user"&gt;Jihwan_Kim&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks so much for the response!&amp;nbsp; I feel like your formula is sooo close.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm receiving an error message - maybe related to the details I'm including (?)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the table I'm looking to add this measure to. (Currently has Earliest Posting Date) but it is not correctly showing since the result shows any posting date with a quantity of 1 or more (versus 3 or more).&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;Here is what I used for a formula in relation to your example:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Min Date Test =
VAR _t =
    ADDCOLUMNS(
        SUMMARIZE(
            ALL ('VALUE ENTRY'),
            'VALUE ENTRY'[Item No],
            'VALUE ENTRY'[Customer],
            'VALUE ENTRY'[Document No],
            'VALUE ENTRY'[Posting Date],
            'VALUE ENTRY'[Quantity]
        ),
        "@runningtotalbyitem",
            CALCULATE(
                SUM('VALUE ENTRY'[Quantity] ),
                WINDOW(
                    1,
                    ABS,
                    0,
                    REL,
                    SUMMARIZE(
                        ALL ('VALUE ENTRY' ),
                        'VALUE ENTRY'[Item No],
                        'VALUE ENTRY'[Customer],
                        'VALUE ENTRY'[Document No],
                        'VALUE ENTRY'[Posting Date],
                        'VALUE ENTRY'[Quantity]
                    ),
                    ORDERBY([Posting Date], ASC ),
                    ,
                    PARTITIONBY('VALUE ENTRY'[Item No] ),
                    MATCHBY('VALUE ENTRY'[Item No], 'VALUE ENTRY'[Customer], 'VALUE ENTRY'[Posting Date], 'VALUE ENTRY'[Document No] )
                )
            )
    )
VAR _condition =
    FILTER( _t, 'VALUE ENTRY'[Item No] = MAX ('VALUE ENTRY'[Item No] ) &amp;amp;&amp;amp; [@runningtotalbyitem] &amp;gt;=3 )
VAR _startdate =
    MINX(_condition, 'VALUE ENTRY'[Posting Date] )
RETURN
    _startdate&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the error message I am receiving:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again!&amp;nbsp;&lt;/P&gt;&lt;P&gt;Christina&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2023 15:10:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Min-Posting-Date-Total-qty-of-3-or-more/m-p/3582186#M138191</guid>
      <dc:creator>christina4444</dc:creator>
      <dc:date>2023-12-13T15:10:49Z</dc:date>
    </item>
    <item>
      <title>Re: Min Posting Date - Total qty of 3 or more</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Min-Posting-Date-Total-qty-of-3-or-more/m-p/3610547#M139571</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="579251" data-lia-user-login="christina4444" class="lia-mention lia-mention-user"&gt;christina4444&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="291628" data-lia-user-login="Jihwan_Kim" class="lia-mention lia-mention-user"&gt;Jihwan_Kim&lt;/a&gt;&amp;nbsp;Good share!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I’m sorry to hear that you’re having trouble calculating the Min Posting Date, here I give you the other method:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's some dummy data&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Create a measure, the cumulative sum of Qty is calculated based on the customer group.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;total Qty = CALCULATE(SUM('Table'[Qty]), FILTER(ALL('Table'),'Table'[Customer] = MAX('Table'[Customer]) &amp;amp;&amp;amp; [Posting Date] &amp;lt;= MAX([Posting Date])))&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Create a measure, group according to customer and total Qty greater than or equal to 3, then return the minimum date. And here is the result:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;_postingDate = MINX(FILTER(ALLSELECTED('Table'), [Customer]=MAX('Table'[Customer]) &amp;amp;&amp;amp; [total Qty] &amp;gt;= 3),[Posting Date])&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Nono Chen&lt;/P&gt;
&lt;P&gt;If this &lt;STRONG&gt;&lt;EM&gt;post&lt;/EM&gt;&lt;/STRONG&gt;&amp;nbsp;helps, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt;&amp;nbsp;to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jan 2024 09:14:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Min-Posting-Date-Total-qty-of-3-or-more/m-p/3610547#M139571</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-01-02T09:14:04Z</dc:date>
    </item>
  </channel>
</rss>

