<?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: Approximate costings in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Approximate-costings/m-p/1218389#M853294</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I will check this out, but from OPs description it seems that he might need a weighted average based on dates here... I will check this out once I reach office&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 21 Mar 2017 10:00:02 GMT</pubDate>
    <dc:creator>sunny_talwar</dc:creator>
    <dc:date>2017-03-21T10:00:02Z</dc:date>
    <item>
      <title>Approximate costings</title>
      <link>https://community.qlik.com/t5/QlikView/Approximate-costings/m-p/1218385#M853290</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So I have a scenario where we don't always have our costings on the system for a product we have sold.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My idea was that maybe I could use a costings table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Basic premise being&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" style="border: 1px solid rgb(0, 0, 0); width: 100%;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;ItemCode&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;TransactionDate&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;CostPerUnit&lt;/STRONG&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;G000AAA&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;01/04/2017&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;0.05&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;G000AAA&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;06/04/2017&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;0.07&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;G000BBB&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;01/08/2017&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;0.65&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Whilst it may not be absolutely the best way of doing it, and I would need to put some logic in it to not always do this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was half tempted to create a kind of rota thing say that 03/04/17 for G000AAA would be 0.06 where it would look at the differences in price per day and could look up via that or failing that, the nearest price.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anyone please give me an insight into doing what I am trying to do, if its even possible.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;James&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Nov 2020 16:16:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Approximate-costings/m-p/1218385#M853290</guid>
      <dc:creator>james_hanify</dc:creator>
      <dc:date>2020-11-25T16:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: Approximate costings</title>
      <link>https://community.qlik.com/t5/QlikView/Approximate-costings/m-p/1218386#M853291</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi James,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please find attached an example of this, I think I've understood your requirements but obviously the example is a simple one.&lt;/P&gt;&lt;P&gt;Just ask if you have any questions about it at all.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Adam&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Mar 2017 11:54:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Approximate-costings/m-p/1218386#M853291</guid>
      <dc:creator>adamdavi3s</dc:creator>
      <dc:date>2017-03-02T11:54:22Z</dc:date>
    </item>
    <item>
      <title>Re: Approximate costings</title>
      <link>https://community.qlik.com/t5/QlikView/Approximate-costings/m-p/1218387#M853292</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Adam,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for this,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But if i'm right, yours kind of creates a value based on the average? Rather than the average based on the order date overall?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The idea is to get an average based on the transaction date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So e.g. Product A has price 30p on 1st, 35p on 5th, so if invoiced on the 3rd it would be something like 32.5p&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;James.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Mar 2017 11:06:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Approximate-costings/m-p/1218387#M853292</guid>
      <dc:creator>james_hanify</dc:creator>
      <dc:date>2017-03-20T11:06:14Z</dc:date>
    </item>
    <item>
      <title>Re: Approximate costings</title>
      <link>https://community.qlik.com/t5/QlikView/Approximate-costings/m-p/1218388#M853293</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi James,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sorry trying to remember what I did for this one &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, my main aim here was to show how you could use a static price table in the absence of any prior pricing being available. - Does this bit work how you anticipated?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regarding the average price, in this case yes Qlik is just calculating the average based on any selections, so in the raw form then yes the average for all time. If you select a date or a range then it will show the average for that range.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So it depends what your scenario is, if it is a case that you want the average to update every time new data is loaded then this will be working correctly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However I am guessing your scenario is something like the attached in that you want the invoice price on a set date to be calculated based on all previous orders to that date? I haven't quite got time to figure the logic but I bet you &lt;A href="https://community.qlik.com/qlik-users/171708"&gt;stalwar1&lt;/A&gt;‌ will be able to knock it out in a second &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Mar 2017 08:36:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Approximate-costings/m-p/1218388#M853293</guid>
      <dc:creator>adamdavi3s</dc:creator>
      <dc:date>2017-03-21T08:36:26Z</dc:date>
    </item>
    <item>
      <title>Re: Approximate costings</title>
      <link>https://community.qlik.com/t5/QlikView/Approximate-costings/m-p/1218389#M853294</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I will check this out, but from OPs description it seems that he might need a weighted average based on dates here... I will check this out once I reach office&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Mar 2017 10:00:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Approximate-costings/m-p/1218389#M853294</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2017-03-21T10:00:02Z</dc:date>
    </item>
    <item>
      <title>Re: Approximate costings</title>
      <link>https://community.qlik.com/t5/QlikView/Approximate-costings/m-p/1218390#M853295</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I could be totally wrong, but is this what you want?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Capture.PNG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/156962_Capture.PNG" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Where the input is this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Table:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD * INLINE [&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ItemCode, TransactionDate, CostPerUnit&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; G000AAA, 01/04/2017, 0.05&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; G000AAA, 06/04/2017, 0.07&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; G000AAA, 15/04/2017, 0.12&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; G000AAA, 02/05/2017, 0.26&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; G000BBB, 01/08/2017, 0.65&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; G000BBB, 05/08/2017, 0.68&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; G000BBB, 15/08/2017, 0.71&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;];&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Using the above data as a starting point, I created a CostPerUnit for each TransactionDate using this script&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;FinalTable:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;NoConcatenate&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD ItemCode,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; Date(TransactionDate + IterNo() - 1) as TransactionDate,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; Round(CostPerUnit + (IterNo()-1)*IncrementalCost, 0.0001) as CostPerUnit&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;While TransactionDate + IterNo() - 1 &amp;lt; NextDate;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD *,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; (NextCost-CostPerUnit)/(NextDate-TransactionDate-1) as IncrementalCost;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD *,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; If(ItemCode = Previous(ItemCode), Previous(TransactionDate)) as NextDate,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; If(ItemCode = Previous(ItemCode), Previous(CostPerUnit)) as NextCost&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Resident Table&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Order By ItemCode, TransactionDate desc;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;DROP Table Table;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Mar 2017 11:46:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Approximate-costings/m-p/1218390#M853295</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2017-03-21T11:46:57Z</dc:date>
    </item>
    <item>
      <title>Re: Approximate costings</title>
      <link>https://community.qlik.com/t5/QlikView/Approximate-costings/m-p/1218391#M853296</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That sounds spot on, thanks a lot &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/grin.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 Mar 2017 08:36:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Approximate-costings/m-p/1218391#M853296</guid>
      <dc:creator>james_hanify</dc:creator>
      <dc:date>2017-03-27T08:36:17Z</dc:date>
    </item>
  </channel>
</rss>

