<?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: Load Stat in one table based on Parameters in another in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Load-Stat-in-one-table-based-on-Parameters-in-another/m-p/284471#M105741</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What I have tried is to create a Num(true/false) field in the initial load of the detail portion of the tickets. Then from a resident table load I've pulled the "max" of that field. Taking the max only will return 1 if there any of the records are true and 0 if all are false.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;P_Addon:&lt;/P&gt;&lt;P&gt;LOAD &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; %_CHECKKEY,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Max(Detail.Primary) as P_Addon&lt;/P&gt;&lt;P&gt;Resident Detail&lt;/P&gt;&lt;P&gt;Group by %_CHECKKEY;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;S_Addon:&lt;/P&gt;&lt;P&gt;LOAD &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; %_CHECKKEY,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Max(Detail.Secondary) as S_Addon&lt;/P&gt;&lt;P&gt;Resident Detail&lt;/P&gt;&lt;P&gt;Group by %_CHECKKEY;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;From here I did a left join to insert the true false fields into my ticket Header records. So now I can create a chart for header records to see if both parameters are True. If both are true I can do a count of tickets that have an Add On item to get my percentage of up-selling. I then drop the additional tables created with the above syntax.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Checkkey = Store# &amp;amp; Ticket# &amp;amp; Datevalue&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;True/False fields in the initial Detail records load:&lt;/P&gt;&lt;P&gt;Num(If(ClassMMSCodeNumeric = '001',1,0))as Primary,&lt;/P&gt;&lt;P&gt;Num(If(ClassMMSCodeNumeric = '070' or ClassMMSCodeNumeric ='010' or ClassMMSCodeNumeric ='080',1,0))as Secondary,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 10 May 2011 14:50:36 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2011-05-10T14:50:36Z</dc:date>
    <item>
      <title>Load Stat in one table based on Parameters in another</title>
      <link>https://community.qlik.com/t5/QlikView/Load-Stat-in-one-table-based-on-Parameters-in-another/m-p/284469#M105739</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I need to load a stat of 1 or 0 to a Resident table based on whether or not certain parameters are met in another table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to load into the Header table whether or not it has an Addon item. In order for their to be an add on item per ticket it must have the primary product and a secondary product.&amp;nbsp; The primary class is the 001 and the secondary class is the 070.&amp;nbsp; Header and Detail are loaded prior to the following. All records qualifed other than the Keys.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Header:&lt;/P&gt;&lt;P&gt;Load *,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; If(Count(Detail.ClassMMSCodeNumeric = '001')&amp;gt;0 and Count(Detail.ClassMMSCodeNumeric = '070')&amp;gt;0,1,0) as Addon&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Resident Header;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I get the error of Detail.Class.... can't be found.&amp;nbsp; I do not want to innerjoin the records because then I'd have thousands of header records more then I need which would make calculations from the header record moot without forcing Distinct calculations into my charts.&amp;nbsp; Is this possible?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will be used to gauge up-selling.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 May 2011 17:33:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Load-Stat-in-one-table-based-on-Parameters-in-another/m-p/284469#M105739</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-05-09T17:33:19Z</dc:date>
    </item>
    <item>
      <title>Load Stat in one table based on Parameters in another</title>
      <link>https://community.qlik.com/t5/QlikView/Load-Stat-in-one-table-based-on-Parameters-in-another/m-p/284470#M105740</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;A possible solution could be to load distinct keys from the Detail table while checking the parameters laid out.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am getting an invalid expression error when trying to do this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Invalid expression&lt;/P&gt;&lt;P&gt;Addon:&lt;/P&gt;&lt;P&gt;Load &lt;/P&gt;&lt;P&gt;Distinct %_CHECKKEY,&lt;/P&gt;&lt;P&gt;If(Count(Detail.ClassMMSCodeNumeric = '001')&amp;gt;0 and Count(Detail.ClassMMSCodeNumeric = '070')&amp;gt;0,1,0) as Addon&lt;/P&gt;&lt;P&gt;Resident Detail&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Since each header row would have normally &amp;gt;1 detail row how can I consolidate the detail rows into 1 record saying True of False? I realize the load is taking one record at a time. Is it possible to evaluate several records, then insert 1 record into my table?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 May 2011 18:10:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Load-Stat-in-one-table-based-on-Parameters-in-another/m-p/284470#M105740</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-05-09T18:10:57Z</dc:date>
    </item>
    <item>
      <title>Re: Load Stat in one table based on Parameters in another</title>
      <link>https://community.qlik.com/t5/QlikView/Load-Stat-in-one-table-based-on-Parameters-in-another/m-p/284471#M105741</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What I have tried is to create a Num(true/false) field in the initial load of the detail portion of the tickets. Then from a resident table load I've pulled the "max" of that field. Taking the max only will return 1 if there any of the records are true and 0 if all are false.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;P_Addon:&lt;/P&gt;&lt;P&gt;LOAD &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; %_CHECKKEY,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Max(Detail.Primary) as P_Addon&lt;/P&gt;&lt;P&gt;Resident Detail&lt;/P&gt;&lt;P&gt;Group by %_CHECKKEY;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;S_Addon:&lt;/P&gt;&lt;P&gt;LOAD &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; %_CHECKKEY,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Max(Detail.Secondary) as S_Addon&lt;/P&gt;&lt;P&gt;Resident Detail&lt;/P&gt;&lt;P&gt;Group by %_CHECKKEY;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;From here I did a left join to insert the true false fields into my ticket Header records. So now I can create a chart for header records to see if both parameters are True. If both are true I can do a count of tickets that have an Add On item to get my percentage of up-selling. I then drop the additional tables created with the above syntax.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Checkkey = Store# &amp;amp; Ticket# &amp;amp; Datevalue&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;True/False fields in the initial Detail records load:&lt;/P&gt;&lt;P&gt;Num(If(ClassMMSCodeNumeric = '001',1,0))as Primary,&lt;/P&gt;&lt;P&gt;Num(If(ClassMMSCodeNumeric = '070' or ClassMMSCodeNumeric ='010' or ClassMMSCodeNumeric ='080',1,0))as Secondary,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 May 2011 14:50:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Load-Stat-in-one-table-based-on-Parameters-in-another/m-p/284471#M105741</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-05-10T14:50:36Z</dc:date>
    </item>
  </channel>
</rss>

