<?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 Create a new field in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Create-a-new-field/m-p/280995#M1202510</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is there one record per city? If so, something like this should work:&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;Countries:&lt;BR /&gt;LOAD * INLINE [&lt;BR /&gt; Country, City, Population&lt;BR /&gt; USA, Minneapolis, 10&lt;BR /&gt; USA, New York, 40&lt;BR /&gt; USA, Aimes, 1&lt;BR /&gt; Canada, Toronto, 20&lt;BR /&gt; Canada, Vancouver, 10&lt;BR /&gt;];&lt;BR /&gt;BiggestCities:&lt;BR /&gt;LOAD Country, Max(Population) As MaxPopulation&lt;BR /&gt;RESIDENT Countries&lt;BR /&gt;GROUP BY Country;&lt;BR /&gt;DataInter:&lt;BR /&gt;LOAD Country As tCountry,&lt;BR /&gt; City as tCity,&lt;BR /&gt; Population As tPopulation&lt;BR /&gt;RESIDENT Countries;&lt;BR /&gt;JOIN LOAD Country As tCountry, MaxPopulation As tMaxPopulation&lt;BR /&gt;RESIDENT BiggestCities;&lt;BR /&gt;DROP TABLE Countries;&lt;BR /&gt;DROP TABLE BiggestCities;&lt;BR /&gt;Data:&lt;BR /&gt;LOAD tCountry As Country, tCity As City, tPopulation As Population,&lt;BR /&gt; If(tPopulation = tMaxPopulation, 'Biggest City', 'Other') As Status&lt;BR /&gt;RESIDENT DataInter;&lt;BR /&gt;DROP TABLE DataInter;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;That's probably not the most effecient way to do it, but it works. Replace the Inline load with however you are currently loading your data and the rest should work directly.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 05 Oct 2010 20:55:36 GMT</pubDate>
    <dc:creator />
    <dc:date>2010-10-05T20:55:36Z</dc:date>
    <item>
      <title>Create a new field</title>
      <link>https://community.qlik.com/t5/QlikView/Create-a-new-field/m-p/280991#M1202506</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have a table with 3 fields :&lt;/P&gt;&lt;P&gt;Country&lt;/P&gt;&lt;P&gt;City&lt;/P&gt;&lt;P&gt;Population&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'd like to add a new field in my table , let's said Status where&lt;/P&gt;&lt;P&gt;Status = 'Biggest City' if the city is the biggest city within the country&lt;/P&gt;&lt;P&gt;Status = 'Other' if the city is not the biggest&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for any help&lt;/P&gt;&lt;P&gt;Jean-Jacques&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Oct 2010 20:23:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Create-a-new-field/m-p/280991#M1202506</guid>
      <dc:creator />
      <dc:date>2010-10-05T20:23:39Z</dc:date>
    </item>
    <item>
      <title>Create a new field</title>
      <link>https://community.qlik.com/t5/QlikView/Create-a-new-field/m-p/280992#M1202507</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can load from resident table......and make a condition.....&lt;/P&gt;&lt;P&gt;something like IF(Population&amp;gt;30000,'Biggest City','Other') AS Status&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Oct 2010 20:36:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Create-a-new-field/m-p/280992#M1202507</guid>
      <dc:creator />
      <dc:date>2010-10-05T20:36:56Z</dc:date>
    </item>
    <item>
      <title>Create a new field</title>
      <link>https://community.qlik.com/t5/QlikView/Create-a-new-field/m-p/280993#M1202508</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Not exactly, because I want to identify for each country the biggest one.&lt;/P&gt;&lt;P&gt;JJJ&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Oct 2010 20:41:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Create-a-new-field/m-p/280993#M1202508</guid>
      <dc:creator />
      <dc:date>2010-10-05T20:41:12Z</dc:date>
    </item>
    <item>
      <title>Create a new field</title>
      <link>https://community.qlik.com/t5/QlikView/Create-a-new-field/m-p/280994#M1202509</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;i don´t now what is your rule....but if you put that expression in your load....you will identify each line(country)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Oct 2010 20:46:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Create-a-new-field/m-p/280994#M1202509</guid>
      <dc:creator />
      <dc:date>2010-10-05T20:46:05Z</dc:date>
    </item>
    <item>
      <title>Create a new field</title>
      <link>https://community.qlik.com/t5/QlikView/Create-a-new-field/m-p/280995#M1202510</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is there one record per city? If so, something like this should work:&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;Countries:&lt;BR /&gt;LOAD * INLINE [&lt;BR /&gt; Country, City, Population&lt;BR /&gt; USA, Minneapolis, 10&lt;BR /&gt; USA, New York, 40&lt;BR /&gt; USA, Aimes, 1&lt;BR /&gt; Canada, Toronto, 20&lt;BR /&gt; Canada, Vancouver, 10&lt;BR /&gt;];&lt;BR /&gt;BiggestCities:&lt;BR /&gt;LOAD Country, Max(Population) As MaxPopulation&lt;BR /&gt;RESIDENT Countries&lt;BR /&gt;GROUP BY Country;&lt;BR /&gt;DataInter:&lt;BR /&gt;LOAD Country As tCountry,&lt;BR /&gt; City as tCity,&lt;BR /&gt; Population As tPopulation&lt;BR /&gt;RESIDENT Countries;&lt;BR /&gt;JOIN LOAD Country As tCountry, MaxPopulation As tMaxPopulation&lt;BR /&gt;RESIDENT BiggestCities;&lt;BR /&gt;DROP TABLE Countries;&lt;BR /&gt;DROP TABLE BiggestCities;&lt;BR /&gt;Data:&lt;BR /&gt;LOAD tCountry As Country, tCity As City, tPopulation As Population,&lt;BR /&gt; If(tPopulation = tMaxPopulation, 'Biggest City', 'Other') As Status&lt;BR /&gt;RESIDENT DataInter;&lt;BR /&gt;DROP TABLE DataInter;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;That's probably not the most effecient way to do it, but it works. Replace the Inline load with however you are currently loading your data and the rest should work directly.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Oct 2010 20:55:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Create-a-new-field/m-p/280995#M1202510</guid>
      <dc:creator />
      <dc:date>2010-10-05T20:55:36Z</dc:date>
    </item>
    <item>
      <title>Create a new field</title>
      <link>https://community.qlik.com/t5/QlikView/Create-a-new-field/m-p/280996#M1202511</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Nmiller,&lt;/P&gt;&lt;P&gt;I simplified your syntax using firstsortedvalue function&lt;/P&gt;&lt;P&gt;LEFT JOIN (Temp)&lt;BR /&gt;LOAD Country , firstsortedvalue(City , -Population ) as BiggestCity&lt;BR /&gt;RESIDENT Temp&lt;BR /&gt;Group By County ;&lt;BR /&gt;&lt;BR /&gt;Data:&lt;/P&gt;&lt;P&gt;LOAD * , If(City=BiggestCity,'Biggest City', 'Other') as Status&lt;/P&gt;&lt;P&gt;Resident Temp;&lt;BR /&gt;Drop Table Temp;&lt;/P&gt;&lt;P&gt;JJJ&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Oct 2010 21:55:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Create-a-new-field/m-p/280996#M1202511</guid>
      <dc:creator />
      <dc:date>2010-10-05T21:55:02Z</dc:date>
    </item>
  </channel>
</rss>

