<?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 Data based on different date variables? in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Data-based-on-different-date-variables/m-p/1012416#M939026</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;I have a simple question, but probably with a complicated answer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a data table which contains simplified:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Customer - Order - Article - #Delivered - #Sales - #Returns - OrderDATE - SalesDATE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now I get stock reports from the customers which contain the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;Customer - Article - #Stockamount - StockDATE&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;Now I want to calculate their #Stockamount and our virtual stock amount (as a sum: #Delivered - #Sales - #Returns = stock) and compare those.&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;But now I only want to use their latest StockDATE (ie. sum({&amp;lt;StockDATE = {$(=max(StockDATE))}&amp;gt;} #Stockamount)) to calculate their stock.&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;Here I run into problem 1; It will only calculate based on the max StockDATE found, not per customer in the table., untill I select a customer.&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;The second problem I have is that I want to base the #Delivered, #Sales and #Returns on DATE, everything between first known date UNTILL the max StockDATE, And this is different for each customer as well. &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;Any thought or ideas?&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 11 Feb 2016 10:21:41 GMT</pubDate>
    <dc:creator />
    <dc:date>2016-02-11T10:21:41Z</dc:date>
    <item>
      <title>Data based on different date variables?</title>
      <link>https://community.qlik.com/t5/QlikView/Data-based-on-different-date-variables/m-p/1012416#M939026</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;I have a simple question, but probably with a complicated answer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a data table which contains simplified:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Customer - Order - Article - #Delivered - #Sales - #Returns - OrderDATE - SalesDATE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now I get stock reports from the customers which contain the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;Customer - Article - #Stockamount - StockDATE&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;Now I want to calculate their #Stockamount and our virtual stock amount (as a sum: #Delivered - #Sales - #Returns = stock) and compare those.&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;But now I only want to use their latest StockDATE (ie. sum({&amp;lt;StockDATE = {$(=max(StockDATE))}&amp;gt;} #Stockamount)) to calculate their stock.&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;Here I run into problem 1; It will only calculate based on the max StockDATE found, not per customer in the table., untill I select a customer.&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;The second problem I have is that I want to base the #Delivered, #Sales and #Returns on DATE, everything between first known date UNTILL the max StockDATE, And this is different for each customer as well. &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;Any thought or ideas?&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Feb 2016 10:21:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Data-based-on-different-date-variables/m-p/1012416#M939026</guid>
      <dc:creator />
      <dc:date>2016-02-11T10:21:41Z</dc:date>
    </item>
    <item>
      <title>Re: Data based on different date variables?</title>
      <link>https://community.qlik.com/t5/QlikView/Data-based-on-different-date-variables/m-p/1012417#M939027</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try for your first topic something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum(aggr(firstsortedvalue(&lt;SPAN style="font-size: 13.3333px;"&gt;#Stockamount, -&lt;SPAN style="font-size: 13.3333px;"&gt;StockDATE), Customer))&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;By your second topic I'm not sure if something similar could be applied. Quite often it's helpful to precalculate such things like the max(StockDATE) within the script like:&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;Max&lt;SPAN style="font-size: 13.3333px;"&gt;StockDATE:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;Load Customer, &lt;SPAN style="font-size: 13.3333px;"&gt;max(StockDATE) as &lt;SPAN style="font-size: 13.3333px;"&gt;Max&lt;SPAN style="font-size: 13.3333px;"&gt;StockDATE Resident abc Group by Customer;&lt;/SPAN&gt;&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;and use this field within your expressions.&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;- Marcus&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Feb 2016 11:53:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Data-based-on-different-date-variables/m-p/1012417#M939027</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2016-02-11T11:53:33Z</dc:date>
    </item>
    <item>
      <title>Re: Data based on different date variables?</title>
      <link>https://community.qlik.com/t5/QlikView/Data-based-on-different-date-variables/m-p/1012418#M939028</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your reply. The firstsortedvalue aggr doesnt give me any good results.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;About the second part, I have added that to the script already. But How can I filter? It won't be linked to any of my dates whatsoever and I can't get it to work properly in my expressions. I will post an example asap. Reloading as we speak..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Feb 2016 12:08:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Data-based-on-different-date-variables/m-p/1012418#M939028</guid>
      <dc:creator />
      <dc:date>2016-02-11T12:08:40Z</dc:date>
    </item>
  </channel>
</rss>

