<?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: Determine Average Number of Days Overdue in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Determine-Average-Number-of-Days-Overdue/m-p/89027#M14520</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;why should I do a weighted average? I want an invoice to be distinct.&amp;nbsp; I only want to count it once. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 19 Sep 2018 17:38:23 GMT</pubDate>
    <dc:creator>djbloiss</dc:creator>
    <dc:date>2018-09-19T17:38:23Z</dc:date>
    <item>
      <title>Determine Average Number of Days Overdue</title>
      <link>https://community.qlik.com/t5/QlikView/Determine-Average-Number-of-Days-Overdue/m-p/89025#M14518</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I need to figure out, out of all overdue orders, what is the average days overdue for street sales and non street sales (separately).&amp;nbsp; Every field is in the same table. This is what I first tried:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if(Today()-avg({$&amp;lt;Open={1}, [Invoice Number]-={''}&amp;gt;} [Invoice Due Date Num])&amp;gt;0, Today()-avg({$&amp;lt;Open={1}, [Invoice Number]-={''}&amp;gt;} [Invoice Due Date Num]),0)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is another way I tried it:&lt;/P&gt;&lt;P&gt;Today()-(Only({$&amp;lt;Open={1}, [Invoice Number]-={''}&amp;gt;} [Invoice Due Date Num])*Count(DISTINCT aggr([Invoice Number], [Invoice Due Date Num])))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A few points about this data:&lt;/P&gt;&lt;P&gt;1) The problem is there can be multiple records for the same [Invoice Number].&amp;nbsp; Each record for [Invoice Number] would have the same due date&lt;/P&gt;&lt;P&gt;2) StreetSalesFlag is a 1 if it is a street sale and null if it is not. &lt;/P&gt;&lt;P&gt;3) I am excluding any records that have a blank for [Invoice Number].&lt;/P&gt;&lt;P&gt;4) Open is 1 if the Invoice is still open.&amp;nbsp; We don't want to include any closed orders&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What am I doing wrong?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Sep 2018 15:55:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Determine-Average-Number-of-Days-Overdue/m-p/89025#M14518</guid>
      <dc:creator>djbloiss</dc:creator>
      <dc:date>2018-09-19T15:55:31Z</dc:date>
    </item>
    <item>
      <title>Re: Determine Average Number of Days Overdue</title>
      <link>https://community.qlik.com/t5/QlikView/Determine-Average-Number-of-Days-Overdue/m-p/89026#M14519</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I suggest you to solve the problem in data model. (i made a similar analysis).&lt;/P&gt;&lt;P&gt;If you have multiple records for the same inv. number you need to make a rule to do a weighted average.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First of all you should have in the same row the delivery date and the delivery request date by the consumer.&lt;/P&gt;&lt;P&gt;Usually you have :&lt;/P&gt;&lt;P&gt;Invoice Date : sales table,&lt;/P&gt;&lt;P&gt;Delivery Date: sales table,&lt;/P&gt;&lt;P&gt;Delivery request Date: orders table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you can do a mapping load like this:&lt;/P&gt;&lt;P&gt;map_delivery_req_date:&lt;/P&gt;&lt;P&gt;mapping load orders_order_key, delivery_req_date resident orders;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sales:&lt;/P&gt;&lt;P&gt;load*,&lt;/P&gt;&lt;P&gt;applymap ('&lt;SPAN style="font-size: 13.3333px;"&gt;map_delivery_req_date', sales_&lt;SPAN style="font-size: 13.3333px;"&gt;order_key, delivery_date) as delivery_req_date&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;resident SalesW;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;Drop Table SalesW;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;Then you can do the difference between date:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;Interval(delivery_date - delivery_request_date) or&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;if(&lt;SPAN style="font-size: 13.3333px;"&gt;Interval(delivery_date - delivery_request_date) &amp;gt;0, &lt;SPAN style="font-size: 13.3333px;"&gt;Interval(delivery_date - delivery_request_date), 0)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;Then you should decide the rule (for example value)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;sum({ &lt;SPAN style="font-size: 13.3333px;"&gt;if(&lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;Interval(delivery_date - delivery_request_date) &amp;gt;0, &lt;SPAN style="font-size: 13.3333px;"&gt;Interval(delivery_date - delivery_request_date), 0)*quantity*price)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;/sum (total quantity*price)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;if you want to analize only non-processed order change the formula:&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;sum(&lt;SPAN style="font-size: 13.3333px;"&gt;&amp;lt;InvoiceNo={''}&amp;gt;} &lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;if(&lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;Interval(today() - delivery_request_date) &amp;gt;0, &lt;SPAN style="font-size: 13.3333px;"&gt;Interval(delivery_date - delivery_request_date), 0)*quantity*price)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;/sum (total {&lt;SPAN style="font-size: 13.3333px;"&gt;&amp;lt;InvoiceNo={''}&amp;gt;} &lt;/SPAN&gt;quantity*price)&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Sep 2018 16:54:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Determine-Average-Number-of-Days-Overdue/m-p/89026#M14519</guid>
      <dc:creator>captain89</dc:creator>
      <dc:date>2018-09-19T16:54:48Z</dc:date>
    </item>
    <item>
      <title>Re: Determine Average Number of Days Overdue</title>
      <link>https://community.qlik.com/t5/QlikView/Determine-Average-Number-of-Days-Overdue/m-p/89027#M14520</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;why should I do a weighted average? I want an invoice to be distinct.&amp;nbsp; I only want to count it once. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Sep 2018 17:38:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Determine-Average-Number-of-Days-Overdue/m-p/89027#M14520</guid>
      <dc:creator>djbloiss</dc:creator>
      <dc:date>2018-09-19T17:38:23Z</dc:date>
    </item>
    <item>
      <title>Re: Determine Average Number of Days Overdue</title>
      <link>https://community.qlik.com/t5/QlikView/Determine-Average-Number-of-Days-Overdue/m-p/89028#M14521</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In Italy you may have more than one delivery note with different delivery request date in the same invoice. &lt;/P&gt;&lt;P&gt;If you want a complete view of&amp;nbsp; delivery delays as usual.. you should make a rule to do a &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12px; background-color: #f2f2f2;"&gt;weighted average.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;So is for you a delivery delay of 3 days for 1000$ of goods&amp;nbsp; the same of a 10000$ one?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In my opinion you should treat differently the invoices with a greater amount.&lt;/P&gt;&lt;P&gt;I did the analysis with 2 Kpis:&lt;/P&gt;&lt;P&gt;Service Level (weighted - based on amount) (% of deliveries processed in time over the total)&lt;/P&gt;&lt;P&gt;Avg Delivery days od delay ( weighted - based on amount)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is a way to have a complete view of the situation.&lt;/P&gt;&lt;P&gt;Can you attach a sample table ? I would help you but i don't understand the logic of your dataset.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Sep 2018 09:52:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Determine-Average-Number-of-Days-Overdue/m-p/89028#M14521</guid>
      <dc:creator>captain89</dc:creator>
      <dc:date>2018-09-20T09:52:29Z</dc:date>
    </item>
  </channel>
</rss>

