<?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: creating an age group from a date field in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/creating-an-age-group-from-a-date-field/m-p/238555#M89405</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanx Rob, it is a big improvement for me. I have to handle 30+millions of records. Doing it with map instead of IF is faster.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 11 Apr 2018 12:24:52 GMT</pubDate>
    <dc:creator>berndjaegle</dc:creator>
    <dc:date>2018-04-11T12:24:52Z</dc:date>
    <item>
      <title>creating an age group from a date field</title>
      <link>https://community.qlik.com/t5/QlikView/creating-an-age-group-from-a-date-field/m-p/238547#M89397</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 an Age field and am trying to create an Age Group field based around it.&lt;/P&gt;&lt;P&gt;The Age group is&lt;/P&gt;&lt;P&gt;under 16&lt;/P&gt;&lt;P&gt;16-35&lt;/P&gt;&lt;P&gt;36 - 55&lt;/P&gt;&lt;P&gt;56 - 65&lt;/P&gt;&lt;P&gt;Over 65&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Nov 2009 19:13:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/creating-an-age-group-from-a-date-field/m-p/238547#M89397</guid>
      <dc:creator />
      <dc:date>2009-11-11T19:13:58Z</dc:date>
    </item>
    <item>
      <title>creating an age group from a date field</title>
      <link>https://community.qlik.com/t5/QlikView/creating-an-age-group-from-a-date-field/m-p/238548#M89398</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Its best to create the group in the load script and then use this new field called Age_Group.&lt;BR /&gt;Try the below example&lt;/P&gt;&lt;P&gt;LOAD&lt;BR /&gt;if(age &amp;gt; 65, 'Over 65',&lt;BR /&gt;if(age &amp;lt;= 65 and age &amp;gt;= 56, '56 - 65',&lt;BR /&gt;if(age &amp;lt;= 55 and age &amp;gt;= 36, '36 - 55',&lt;BR /&gt;if(age &amp;lt;= 35 and age &amp;gt;= 16, '16 - 35',&lt;BR /&gt;if(age &amp;lt; 16, 'Under 16'))))) as Age_Group;&lt;BR /&gt;SQL Select *&lt;BR /&gt;FROM Table1;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Nov 2009 19:42:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/creating-an-age-group-from-a-date-field/m-p/238548#M89398</guid>
      <dc:creator />
      <dc:date>2009-11-11T19:42:09Z</dc:date>
    </item>
    <item>
      <title>creating an age group from a date field</title>
      <link>https://community.qlik.com/t5/QlikView/creating-an-age-group-from-a-date-field/m-p/238549#M89399</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That's pretty much what I'd do, but I'd take advantage of knowing we failed the previous IFs to simplify the expression a bit for performance:&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;if(age &amp;gt; 65, 'Over 65',&lt;BR /&gt;if(age &amp;gt;= 56, '56 - 65',&lt;BR /&gt;if(age &amp;gt;= 36, '36 - 55',&lt;BR /&gt;if(age &amp;gt;= 16, '16 - 35',&lt;BR /&gt; 'Under 16')))) as Age_Group&lt;/P&gt;&lt;P&gt;If performance is an issue, you might also want to see if a mapping table is faster. I think it would look like this:&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;AgeGroups:&lt;BR /&gt;MAPPING LOAD&lt;BR /&gt; Age&lt;BR /&gt;,if(Age &amp;gt; 65, 'Over 65',&lt;BR /&gt;,if(Age &amp;gt;= 56, '56 - 65',&lt;BR /&gt;,if(Age &amp;gt;= 36, '36 - 55',&lt;BR /&gt;,if(Age &amp;gt;= 16, '16 - 35',&lt;BR /&gt; 'Under 16')))) as AgeGroup&lt;BR /&gt;;&lt;BR /&gt;LOAD recno() as Age&lt;BR /&gt;AUTOGENERATE 200&lt;BR /&gt;;&lt;BR /&gt;LOAD *&lt;BR /&gt;,applymap('AgeGroups',Age) as AgeGroup&lt;BR /&gt;;&lt;BR /&gt;SQL SELECT *&lt;BR /&gt;FROM Table1&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;The idea is that you save time by only performing the IF once per age, not once per row. Or for that matter, just leave AgeGroups as a separate table linked to your main table by Age. That will probably load fastest, but may be slightly slower to display in charts. Just guessing, though.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Nov 2009 06:24:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/creating-an-age-group-from-a-date-field/m-p/238549#M89399</guid>
      <dc:creator>johnw</dc:creator>
      <dc:date>2009-11-12T06:24:22Z</dc:date>
    </item>
    <item>
      <title>creating an age group from a date field</title>
      <link>https://community.qlik.com/t5/QlikView/creating-an-age-group-from-a-date-field/m-p/238550#M89400</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm trying to implement your previous suggestion for my numeric field called Age which is located in a table I call Data. (The Data table I created from a .txt file.) I get the following error message:&lt;/P&gt;&lt;P&gt;ODBC connection failed&lt;BR /&gt;SQL Select *&lt;BR /&gt;FROM Data&lt;/P&gt;&lt;P&gt;I'm guessing that I can't use the code SQL Select * but I'm not sure what to substitute.&lt;/P&gt;&lt;P&gt;Any help would be appreciated!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Dec 2009 04:31:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/creating-an-age-group-from-a-date-field/m-p/238550#M89400</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-12-11T04:31:47Z</dc:date>
    </item>
    <item>
      <title>creating an age group from a date field</title>
      <link>https://community.qlik.com/t5/QlikView/creating-an-age-group-from-a-date-field/m-p/238551#M89401</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The example I gave was merely an example. If you're loading from a text file instead of from an ODBC data source that uses SQL, you don't want to use an SQL select. You want to load from your text file the way you normally do.&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;AgeGroups:&lt;BR /&gt;MAPPING LOAD&lt;BR /&gt; Age&lt;BR /&gt;,if(Age &amp;gt; 65, 'Over 65',&lt;BR /&gt;,if(Age &amp;gt;= 56, '56 - 65',&lt;BR /&gt;,if(Age &amp;gt;= 36, '36 - 55',&lt;BR /&gt;,if(Age &amp;gt;= 16, '16 - 35',&lt;BR /&gt; 'Under 16')))) as AgeGroup&lt;BR /&gt;;&lt;BR /&gt;LOAD recno() as Age&lt;BR /&gt;AUTOGENERATE 200&lt;BR /&gt;;&lt;BR /&gt;[Your table name goes here]:&lt;BR /&gt;LOAD *&lt;BR /&gt;,applymap('AgeGroups',Age) as AgeGroup&lt;BR /&gt;;&lt;BR /&gt;The same script you've always used to load the fields from your text file goes here.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Dec 2009 06:56:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/creating-an-age-group-from-a-date-field/m-p/238551#M89401</guid>
      <dc:creator>johnw</dc:creator>
      <dc:date>2009-12-11T06:56:02Z</dc:date>
    </item>
    <item>
      <title>creating an age group from a date field</title>
      <link>https://community.qlik.com/t5/QlikView/creating-an-age-group-from-a-date-field/m-p/238552#M89402</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here's an alternative way to create the mapping table that avoids the Ifs (and paren-disease).&lt;/P&gt;&lt;P&gt;AgeGroups:&lt;BR /&gt;MAPPING LOAD&lt;BR /&gt; Low+(iterNo()-1) as Key,&lt;BR /&gt; Group&lt;BR /&gt;WHILE iterNo() &amp;lt;= (High - Low) + 1&lt;BR /&gt;;&lt;BR /&gt;LOAD * INLINE [&lt;BR /&gt;Low, High, Group&lt;BR /&gt;0,15,Under 16&lt;BR /&gt;16,35,16-35&lt;BR /&gt;36,55,36-55&lt;BR /&gt;56,65,56-65&lt;BR /&gt;]&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;TestData:&lt;BR /&gt;LOAD *,&lt;BR /&gt; applyMap('AgeGroups', Age, 'Over 65') as AgeGroup&lt;BR /&gt;;&lt;BR /&gt;LOAD * INLINE [&lt;BR /&gt;Age&lt;BR /&gt;1&lt;BR /&gt;3&lt;BR /&gt;15&lt;BR /&gt;16&lt;BR /&gt;30&lt;BR /&gt;55&lt;BR /&gt;99&lt;BR /&gt;]&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;Not a huge improvement, but may make it easier to maintain the range table.&lt;/P&gt;&lt;P&gt;-Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Dec 2009 13:16:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/creating-an-age-group-from-a-date-field/m-p/238552#M89402</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2009-12-11T13:16:44Z</dc:date>
    </item>
    <item>
      <title>Re: creating an age group from a date field</title>
      <link>https://community.qlik.com/t5/QlikView/creating-an-age-group-from-a-date-field/m-p/238553#M89403</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yet another calculated solution:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if(Age&amp;lt;16, 'Under 16', &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(Age&amp;gt;65, 'Over 65', &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; text(16+(Div(Age-16,20)*20)) &amp;amp; ' - ' &amp;amp; text(35+(Div(Age-16,20)*20)))) as AgeGroup&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But you always have to deal with the fringe groups..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Ralf&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Jul 2012 21:59:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/creating-an-age-group-from-a-date-field/m-p/238553#M89403</guid>
      <dc:creator>rbecher</dc:creator>
      <dc:date>2012-07-20T21:59:08Z</dc:date>
    </item>
    <item>
      <title>Re: creating an age group from a date field</title>
      <link>https://community.qlik.com/t5/QlikView/creating-an-age-group-from-a-date-field/m-p/238554#M89404</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The final touch is to add dual() function so that the groups can be sorted properly.&lt;/P&gt;&lt;P&gt;I think the fringe groups is not a drawback as it's often perceived by users this way even if it's not.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Nov 2012 09:12:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/creating-an-age-group-from-a-date-field/m-p/238554#M89404</guid>
      <dc:creator>whiteline</dc:creator>
      <dc:date>2012-11-05T09:12:37Z</dc:date>
    </item>
    <item>
      <title>Re: creating an age group from a date field</title>
      <link>https://community.qlik.com/t5/QlikView/creating-an-age-group-from-a-date-field/m-p/238555#M89405</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanx Rob, it is a big improvement for me. I have to handle 30+millions of records. Doing it with map instead of IF is faster.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Apr 2018 12:24:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/creating-an-age-group-from-a-date-field/m-p/238555#M89405</guid>
      <dc:creator>berndjaegle</dc:creator>
      <dc:date>2018-04-11T12:24:52Z</dc:date>
    </item>
    <item>
      <title>Re: creating an age group from a date field</title>
      <link>https://community.qlik.com/t5/QlikView/creating-an-age-group-from-a-date-field/m-p/1920478#M1218539</link>
      <description>&lt;P&gt;Hi, I was wondering what's the best way to group customers by the Asset Value without using if condition&lt;/P&gt;
&lt;P&gt;Cust ID&amp;nbsp; &amp;nbsp; Asset Value Segment&lt;/P&gt;
&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt; 1million&lt;/P&gt;
&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1-2 million&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If asset value is coming from another table other than the customer and it is split across&amp;nbsp; months so need needs to be summed up&lt;/P&gt;</description>
      <pubDate>Wed, 20 Apr 2022 13:14:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/creating-an-age-group-from-a-date-field/m-p/1920478#M1218539</guid>
      <dc:creator>surya_30</dc:creator>
      <dc:date>2022-04-20T13:14:16Z</dc:date>
    </item>
  </channel>
</rss>

