<?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 Lastest value of fields in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Lastest-value-of-fields/m-p/175506#M714017</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have the following data&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOAD * INLINE [&lt;BR /&gt; YYYYMM, SALESREP, CUSTOMER, PRODUCT, SALESTERRITORY&lt;BR /&gt; 200901, 10, 2, 3, 1&lt;BR /&gt; 200902, 10, 2, 3, 1&lt;BR /&gt; 201001, 14, 2, 4, 2&lt;BR /&gt;];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And I would like to have&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; YYYYMM, SALESREP, CUSTOMER, PRODUCT, SALESTERRITORY&lt;BR /&gt; 200901, 14, 2, 3, 2&lt;BR /&gt; 200902, 14, 2, 3, 2&lt;BR /&gt; 201001, 14, 2, 4, 2&lt;/P&gt;&lt;P&gt;Only field SALESREP, SALESTERRITORY should take the latest value (we don't want history)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 26 Aug 2010 16:20:56 GMT</pubDate>
    <dc:creator />
    <dc:date>2010-08-26T16:20:56Z</dc:date>
    <item>
      <title>Lastest value of fields</title>
      <link>https://community.qlik.com/t5/QlikView/Lastest-value-of-fields/m-p/175502#M714013</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 would like to put the latest value of a field during the load.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have sales record :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;YYYY, MM, Product, Customer,SalesPerson, SalesTerritory, SalesGroup&lt;/P&gt;&lt;P&gt;and I would like to update these record during loading script to update SalesTerritoty, SalesGroup field with their latest value so that we don't keep history.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your help &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Aug 2010 04:23:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Lastest-value-of-fields/m-p/175502#M714013</guid>
      <dc:creator />
      <dc:date>2010-08-26T04:23:26Z</dc:date>
    </item>
    <item>
      <title>Lastest value of fields</title>
      <link>https://community.qlik.com/t5/QlikView/Lastest-value-of-fields/m-p/175503#M714014</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello.&lt;/P&gt;&lt;P&gt;I'm assuming the lastest value would be determined by the maximum YYYY MM for each Product, Customer and SalesPerson. If so, try the following:&lt;/P&gt;&lt;P&gt;Load YYYY&amp;amp; MM as YYYYMM, Product, Customer, SalesPerson, SalesTerritory, SalesGroup&lt;/P&gt;&lt;P&gt;from TableA;&lt;/P&gt;&lt;P&gt;inner join&lt;/P&gt;&lt;P&gt;Load Product, Customer, SalesPerson, Max(YYYY&amp;amp;MM) as YYYYMM&lt;/P&gt;&lt;P&gt;from TableA;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Aug 2010 13:54:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Lastest-value-of-fields/m-p/175503#M714014</guid>
      <dc:creator>john_duffy</dc:creator>
      <dc:date>2010-08-26T13:54:59Z</dc:date>
    </item>
    <item>
      <title>Lastest value of fields</title>
      <link>https://community.qlik.com/t5/QlikView/Lastest-value-of-fields/m-p/175504#M714015</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you John but it does not update the field SalesTerritory, SalesGroup and create a syn table.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Aug 2010 15:47:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Lastest-value-of-fields/m-p/175504#M714015</guid>
      <dc:creator />
      <dc:date>2010-08-26T15:47:54Z</dc:date>
    </item>
    <item>
      <title>Lastest value of fields</title>
      <link>https://community.qlik.com/t5/QlikView/Lastest-value-of-fields/m-p/175505#M714016</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you post a simple version of the applicaion using an inline load with a description of what you would like the resulting table to look like. Where are the new values for SalesTerritory and SalesGroup obtained?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Aug 2010 15:55:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Lastest-value-of-fields/m-p/175505#M714016</guid>
      <dc:creator>john_duffy</dc:creator>
      <dc:date>2010-08-26T15:55:15Z</dc:date>
    </item>
    <item>
      <title>Lastest value of fields</title>
      <link>https://community.qlik.com/t5/QlikView/Lastest-value-of-fields/m-p/175506#M714017</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have the following data&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOAD * INLINE [&lt;BR /&gt; YYYYMM, SALESREP, CUSTOMER, PRODUCT, SALESTERRITORY&lt;BR /&gt; 200901, 10, 2, 3, 1&lt;BR /&gt; 200902, 10, 2, 3, 1&lt;BR /&gt; 201001, 14, 2, 4, 2&lt;BR /&gt;];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And I would like to have&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; YYYYMM, SALESREP, CUSTOMER, PRODUCT, SALESTERRITORY&lt;BR /&gt; 200901, 14, 2, 3, 2&lt;BR /&gt; 200902, 14, 2, 3, 2&lt;BR /&gt; 201001, 14, 2, 4, 2&lt;/P&gt;&lt;P&gt;Only field SALESREP, SALESTERRITORY should take the latest value (we don't want history)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Aug 2010 16:20:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Lastest-value-of-fields/m-p/175506#M714017</guid>
      <dc:creator />
      <dc:date>2010-08-26T16:20:56Z</dc:date>
    </item>
    <item>
      <title>Lastest value of fields</title>
      <link>https://community.qlik.com/t5/QlikView/Lastest-value-of-fields/m-p/175507#M714018</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The following code will give you the desired results. I am assuming that the only field used to determine which Salesrep and Salesterritory to use is YYYYMM. Let me know if this helps:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P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;] ;&lt;/P&gt;&lt;P style="font-style: italic"&gt;&lt;BR /&gt;Max_YYYYMM_Table:&lt;/P&gt;&lt;P style="font-style: italic"&gt;LOAD MAX(YYYYMM) as MAX_YYYYMM&lt;BR /&gt;Resident Temp_Test_Table&lt;BR /&gt; ;&lt;BR /&gt;&lt;BR /&gt;let vMaxYYMM = peek ('MAX_YYYYMM',0,Max_YYYYMM_Table) ;&lt;/P&gt;&lt;P style="font-style: italic"&gt;Final_Values:&lt;BR /&gt;Load YYYYMM, SALESREP, SALESTERRITORY&lt;BR /&gt; Resident Temp_Test_Table&lt;BR /&gt;WHERE&lt;BR /&gt; YYYYMM = $(vMaxYYMM)&lt;BR /&gt; ;&lt;BR /&gt;&lt;BR /&gt;Test_Table:&lt;BR /&gt;Load YYYYMM, CUSTOMER, PRODUCT&lt;BR /&gt; Resident Temp_Test_Table&lt;BR /&gt; ;&lt;BR /&gt;&lt;BR /&gt;left join&lt;/P&gt;&lt;I&gt;&lt;/I&gt;&lt;P style="font-style: italic"&gt;Load SALESREP, SALESTERRITORY&lt;BR /&gt;Resident Final_Values&lt;BR /&gt; ;&lt;BR /&gt;&lt;BR /&gt;Drop Tables Temp_Test_Table, Max_YYYYMM_Table, Final_Values ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-style: italic"&gt;&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Aug 2010 17:15:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Lastest-value-of-fields/m-p/175507#M714018</guid>
      <dc:creator>john_duffy</dc:creator>
      <dc:date>2010-08-26T17:15:16Z</dc:date>
    </item>
    <item>
      <title>Lastest value of fields</title>
      <link>https://community.qlik.com/t5/QlikView/Lastest-value-of-fields/m-p/175508#M714019</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Nice logic John...!!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Aug 2010 17:42:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Lastest-value-of-fields/m-p/175508#M714019</guid>
      <dc:creator>montubhardwaj</dc:creator>
      <dc:date>2010-08-26T17:42:11Z</dc:date>
    </item>
    <item>
      <title>Lastest value of fields</title>
      <link>https://community.qlik.com/t5/QlikView/Lastest-value-of-fields/m-p/175509#M714020</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks John. I think it will help. I use 2 fields to determine salesrep and territory : customer and YYYYMM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Aug 2010 17:44:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Lastest-value-of-fields/m-p/175509#M714020</guid>
      <dc:creator />
      <dc:date>2010-08-26T17:44:17Z</dc:date>
    </item>
    <item>
      <title>Lastest value of fields</title>
      <link>https://community.qlik.com/t5/QlikView/Lastest-value-of-fields/m-p/175510#M714021</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi John,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried this but it does not work nothing is in Final result.&lt;/P&gt;&lt;P&gt;Can you help me ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Temp_Test_Table:&lt;BR /&gt;LOAD * INLINE [&lt;BR /&gt; YYYYMM, SALESREP, CUSTOMER, PRODUCT, SALESTERRITORY&lt;BR /&gt; 200901, 10, 2, 3, 1&lt;BR /&gt; 200902, 11, 3, 3, 1&lt;BR /&gt; 201001, 14, 2, 4, 2&lt;BR /&gt;] ;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Max_YYYYMM_Table:&lt;BR /&gt;&lt;BR /&gt;LOAD MAX(YYYYMM) as YYYYMM,&lt;BR /&gt;CUSTOMER&lt;BR /&gt;Resident Temp_Test_Table&lt;BR /&gt;group by CUSTOMER;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Final_Values:&lt;BR /&gt;&lt;BR /&gt;LOAD YYYYMM,&lt;BR /&gt; CUSTOMER&lt;BR /&gt;Resident Max_YYYYMM_Table;&lt;BR /&gt;inner join&lt;BR /&gt;LOAD YYYYMM,&lt;BR /&gt; CUSTOMER,SALESREP, SALESTERRITORY&lt;BR /&gt;Resident Temp_Test_Table;&lt;BR /&gt;&lt;BR /&gt;Drop Tables Temp_Test_Table;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Aug 2010 09:40:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Lastest-value-of-fields/m-p/175510#M714021</guid>
      <dc:creator />
      <dc:date>2010-08-27T09:40:11Z</dc:date>
    </item>
    <item>
      <title>Lastest value of fields</title>
      <link>https://community.qlik.com/t5/QlikView/Lastest-value-of-fields/m-p/175511#M714022</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello.&lt;/P&gt;&lt;P&gt;Since you are now obtaining the values for Sales Rep and Sales Territory for the max YYYYMM at the customer level, you do not want to use YYYYMM in your final join. You need to do an inner join to the main table with both YYYYMM and Customer to obtain the Sales Rep and Sales Territory values for each customer. Then you left join these values to the original table. I think the following code will give you the results you are looking for:&lt;/P&gt;&lt;P&gt;Temp_Test_Table:&lt;BR /&gt;LOAD * INLINE [&lt;BR /&gt; YYYYMM, SALESREP, CUSTOMER, PRODUCT, SALESTERRITORY&lt;BR /&gt; 200901, 10, 2, 3, 1&lt;BR /&gt; 200902, 11, 3, 3, 1&lt;BR /&gt; 201001, 14, 2, 4, 2&lt;BR /&gt;] ;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Temp_Max_YYYYMM_Table:&lt;/P&gt;&lt;P&gt;LOAD CUSTOMER,&lt;BR /&gt; MAX(YYYYMM) as YYYYMM&lt;BR /&gt;Resident Temp_Test_Table&lt;BR /&gt;group by CUSTOMER&lt;BR /&gt; ;&lt;BR /&gt;&lt;BR /&gt;Max_YYYYMM_Table:&lt;BR /&gt;Load YYYYMM,&lt;BR /&gt; CUSTOMER,&lt;BR /&gt; SALESREP,&lt;BR /&gt; SALESTERRITORY&lt;BR /&gt;Resident Temp_Test_Table&lt;BR /&gt; ;&lt;BR /&gt;&lt;BR /&gt;inner join&lt;/P&gt;&lt;P&gt;LOAD YYYYMM,&lt;BR /&gt; CUSTOMER&lt;BR /&gt;Resident Temp_Max_YYYYMM_Table&lt;BR /&gt; ;&lt;BR /&gt;&lt;BR /&gt;Final_Table:&lt;BR /&gt;LOAD YYYYMM,&lt;BR /&gt; CUSTOMER,&lt;BR /&gt; PRODUCT&lt;BR /&gt;Resident Temp_Test_Table&lt;BR /&gt; ;&lt;BR /&gt;&lt;BR /&gt;left join&lt;/P&gt;&lt;P&gt;LOAD&lt;BR /&gt; CUSTOMER,&lt;BR /&gt; SALESREP,&lt;BR /&gt; SALESTERRITORY&lt;BR /&gt;Resident Max_YYYYMM_Table&lt;BR /&gt; ;&lt;BR /&gt;&lt;BR /&gt;Drop Tables Temp_Test_Table, Temp_Max_YYYYMM_Table, Max_YYYYMM_Table;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Aug 2010 13:25:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Lastest-value-of-fields/m-p/175511#M714022</guid>
      <dc:creator>john_duffy</dc:creator>
      <dc:date>2010-08-27T13:25:22Z</dc:date>
    </item>
    <item>
      <title>Lastest value of fields</title>
      <link>https://community.qlik.com/t5/QlikView/Lastest-value-of-fields/m-p/175512#M714023</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you John ! It is working&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 29 Aug 2010 09:16:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Lastest-value-of-fields/m-p/175512#M714023</guid>
      <dc:creator />
      <dc:date>2010-08-29T09:16:19Z</dc:date>
    </item>
  </channel>
</rss>

