<?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: OTIF For Multiple Line Orders in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/OTIF-For-Multiple-Line-Orders/m-p/3597543#M139008</link>
    <description>&lt;P&gt;Few questions&lt;/P&gt;&lt;P&gt;I could not get your measure for counting deliveries to work:&lt;/P&gt;&lt;PRE&gt;Total_Orders = CALCULATE(COUNTROWS('OTIF Table'), FILTER('OTIF Table', [Delivery] = MAX([Delivery])))&lt;/PRE&gt;&lt;P&gt;I used&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Total_Orders =&lt;/SPAN&gt; &lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;DISTINCTCOUNT&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;OTIF&lt;/SPAN&gt;&lt;SPAN&gt;[Delivery]&lt;/SPAN&gt;&lt;SPAN&gt;)) and it gave me the desired result.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Second question&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;SPAN&gt;Not sure I understand what the value should be. In my full report it produced a value of "1"&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;P&gt;&amp;nbsp;is this the desired result?&lt;/P&gt;&lt;PRE&gt;on time in full = var _count1=COUNTROWS(FILTER(ALLSELECTED('OTIF Table'),[Delivery]=MAX('OTIF Table'[Delivery])))
var _count2=COUNTROWS(FILTER(ALLSELECTED('OTIF Table'),[On-Time]="Yes"&amp;amp;&amp;amp;[Full]="Yes"&amp;amp;&amp;amp;[Delivery]=MAX('OTIF Table'[Delivery])))
return IF(_count1=_count2,1,0)&lt;/PRE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;Thank you for responing so quickly.&lt;/P&gt;</description>
    <pubDate>Thu, 21 Dec 2023 19:39:49 GMT</pubDate>
    <dc:creator>GMadd</dc:creator>
    <dc:date>2023-12-21T19:39:49Z</dc:date>
    <item>
      <title>OTIF For Multiple Line Orders</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/OTIF-For-Multiple-Line-Orders/m-p/3592424#M138716</link>
      <description>&lt;P&gt;I have been trying all day how to calculate OTIF for customer orders when there is multiple lines on the order. If one of the lines is short on a three line order the entire is considered short and not on time. I know how to calculate the on-time part by having a formlua to compare the DlvPlnd PGI dt (date to ship) and the Act. Gds Mvmnt Date (date shipped). Also, know how to calculate if it was shipped in full.&amp;nbsp; I am stuck on how to calculate the OTIF % based for each Delivery considering if one of the lines was short. Keep in mind everything is based off of column "G" Delivery meaning every item on the specifed delivery always shipped together. I know the data in the screen shot is in excel but I am wanting to write a DAX measure to handle this in Power BI. Thank you for your help.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Dec 2023 23:18:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/OTIF-For-Multiple-Line-Orders/m-p/3592424#M138716</guid>
      <dc:creator>GMadd</dc:creator>
      <dc:date>2023-12-19T23:18:06Z</dc:date>
    </item>
    <item>
      <title>Re: OTIF For Multiple Line Orders</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/OTIF-For-Multiple-Line-Orders/m-p/3593310#M138786</link>
      <description>&lt;H3&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="663206" data-lia-user-login="GMadd" class="lia-mention lia-mention-user"&gt;GMadd&lt;/a&gt;&amp;nbsp;&lt;/H3&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have understood about your problem, here is the solution I offer:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The data from the screenshot you provided is used here&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;First, calculate the total number of orders after removing duplicate values&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_Orders = CALCULATE(COUNTROWS('OTIF Table'), FILTER('OTIF Table', [Delivery] = MAX([Delivery])))&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then calculate the number of orders when both on-time and full are "yes", and deduplicate:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;_count1 counts the total number of orders grouped by Delivery&lt;/P&gt;
&lt;P&gt;_count2 counts the total number of orders that have passed through the Delivery group and meet the filter conditions&lt;/P&gt;
&lt;P&gt;If _count1 and _count2 are equal, it is recorded as a record&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;on time in full = var _count1=COUNTROWS(FILTER(ALLSELECTED('OTIF Table'),[Delivery]=MAX('OTIF Table'[Delivery])))
var _count2=COUNTROWS(FILTER(ALLSELECTED('OTIF Table'),[On-Time]="Yes"&amp;amp;&amp;amp;[Full]="Yes"&amp;amp;&amp;amp;[Delivery]=MAX('OTIF Table'[Delivery])))
return IF(_count1=_count2,1,0)
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Count how many order records there are&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 on time in full = CALCULATE(DISTINCTCOUNT('OTIF Table'[Delivery]),FILTER('OTIF Table',[on time in full]=1))&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The results of these measures are as follows, which you can understand in conjunction with DAX&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Finally, calculate the percentage&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;OTIF % = DIVIDE([Total on time in full], [Total_Orders])&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;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;P&gt;Best 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;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Dec 2023 09:14:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/OTIF-For-Multiple-Line-Orders/m-p/3593310#M138786</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-12-20T09:14:18Z</dc:date>
    </item>
    <item>
      <title>Re: OTIF For Multiple Line Orders</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/OTIF-For-Multiple-Line-Orders/m-p/3597543#M139008</link>
      <description>&lt;P&gt;Few questions&lt;/P&gt;&lt;P&gt;I could not get your measure for counting deliveries to work:&lt;/P&gt;&lt;PRE&gt;Total_Orders = CALCULATE(COUNTROWS('OTIF Table'), FILTER('OTIF Table', [Delivery] = MAX([Delivery])))&lt;/PRE&gt;&lt;P&gt;I used&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Total_Orders =&lt;/SPAN&gt; &lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;DISTINCTCOUNT&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;OTIF&lt;/SPAN&gt;&lt;SPAN&gt;[Delivery]&lt;/SPAN&gt;&lt;SPAN&gt;)) and it gave me the desired result.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Second question&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;SPAN&gt;Not sure I understand what the value should be. In my full report it produced a value of "1"&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;P&gt;&amp;nbsp;is this the desired result?&lt;/P&gt;&lt;PRE&gt;on time in full = var _count1=COUNTROWS(FILTER(ALLSELECTED('OTIF Table'),[Delivery]=MAX('OTIF Table'[Delivery])))
var _count2=COUNTROWS(FILTER(ALLSELECTED('OTIF Table'),[On-Time]="Yes"&amp;amp;&amp;amp;[Full]="Yes"&amp;amp;&amp;amp;[Delivery]=MAX('OTIF Table'[Delivery])))
return IF(_count1=_count2,1,0)&lt;/PRE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;Thank you for responing so quickly.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Dec 2023 19:39:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/OTIF-For-Multiple-Line-Orders/m-p/3597543#M139008</guid>
      <dc:creator>GMadd</dc:creator>
      <dc:date>2023-12-21T19:39:49Z</dc:date>
    </item>
  </channel>
</rss>

