<?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 Select values from an unjoined table using calculated values in a chart in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Select-values-from-an-unjoined-table-using-calculated-values-in/m-p/1268348#M26024</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have struggled with this issue for a few days with no real success, so it looks like I need expert advice.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My task is to pull in detailed records, summarize those records and compute subtotals in a chart.&amp;nbsp; Then based on the summarized subtotals, go out to another (unjoined) table, and select "reward" amounts.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My summarized table looks like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" width="1365"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD height="20" width="105"&gt;Dealer Name&lt;/TD&gt;&lt;TD width="105"&gt;Dlr #&lt;/TD&gt;&lt;TD width="105"&gt;Phone&lt;/TD&gt;&lt;TD width="105"&gt;State&lt;/TD&gt;&lt;TD width="105"&gt;Owner&lt;/TD&gt;&lt;TD class="xl63" width="105"&gt;Appl #&lt;/TD&gt;&lt;TD class="xl64" width="105"&gt;Appl $&lt;/TD&gt;&lt;TD class="xl63" width="105"&gt;Approve #&lt;/TD&gt;&lt;TD class="xl64" width="105"&gt;Approve $&lt;/TD&gt;&lt;TD class="xl63" width="105"&gt;Purch #&lt;/TD&gt;&lt;TD class="xl64" width="105"&gt;Purch $&lt;/TD&gt;&lt;TD class="xl65" width="105"&gt;Funded %&lt;/TD&gt;&lt;TD class="xl66" width="105"&gt;Prize $&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="20"&gt;XYZ&lt;/TD&gt;&lt;TD&gt;2005&lt;/TD&gt;&lt;TD&gt;123-456-7890&lt;/TD&gt;&lt;TD&gt;FL&lt;/TD&gt;&lt;TD&gt;Owner Name&lt;/TD&gt;&lt;TD align="right" class="xl63"&gt;111&lt;/TD&gt;&lt;TD align="right" class="xl64"&gt;$412,206.00&lt;/TD&gt;&lt;TD align="right" class="xl63"&gt;86&lt;/TD&gt;&lt;TD align="right" class="xl64"&gt;$319,868.00&lt;/TD&gt;&lt;TD align="right" class="xl63"&gt;64&lt;/TD&gt;&lt;TD align="right" class="xl64"&gt;$238,949.00&lt;/TD&gt;&lt;TD align="right" class="xl65"&gt;74.4%&lt;/TD&gt;&lt;TD align="right" class="xl67"&gt;600.00&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There will be several rows in this table.&amp;nbsp; For each row, I would want to lookup the Purch $ and Funded % (these are master measures with somewhat involved computations), in another unjoined table of rewards.&amp;nbsp; In this made up example, since the Purch $ is between 200,000 and 250,000, and the Funded % is greater than 60% the lookup reward would be 600.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here are some of the things that I have considered.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Qlik Sense has a lookup function, but this does not work in the chart environment.&amp;nbsp; I am unable to lookup these values in the load editor as I am starting with detail (loan) records and the summary (by dealer) is done at the chart level.&amp;nbsp; There are other functions that I also ruled out because they do not work at the chart level.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I thought the FieldIndex (and FieldValue) functions might be the answer.&amp;nbsp; To that end, I developed a way to combine the Purch $ and Funded % together by first rounding each to appropriate levels and then adding them together.&amp;nbsp; (In this made up example the combined value would be 200000.6)&amp;nbsp; I then can work with 2 columns in my reward table: a FundRatio field and a Prize field.&amp;nbsp; My latest Reward function looks like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if($(=$(vPurchD))&amp;lt;min(FundLow) or $(=$(vFundPerc))&amp;lt;min(RatioLow) ,0,&lt;/P&gt;&lt;P&gt;round(FieldValue('Prize',&lt;/P&gt;&lt;P&gt;FieldIndex('FundRatio',&lt;/P&gt;&lt;P&gt;num(if($(=$(vPurchD))&amp;gt;max(FundLow),max(FundLow),&lt;/P&gt;&lt;P&gt;if(floor($(=$(vPurchD))/50000)*50000&amp;lt;min(FundLow),min(FundLow),floor($(=$(vPurchD))/50000)*50000)&lt;/P&gt;&lt;P&gt;+if($(=$(vFundPerc))&amp;gt;max(RatioLow),max(RatioLow),floor($(=$(vFundPerc))*20)/20)&lt;/P&gt;&lt;P&gt;)))))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I switched to using variables in the Reward function in order to try and force recalculation.&amp;nbsp; While some of this function appears to work fine, the FieldIndex function does not pull a row number as it should.&amp;nbsp; I am now wondering if the FieldIndex function is intended to work as I would want it to.&amp;nbsp; Namely, I would like it to find the matching row number, then I could use this row number in the FieldValue function to find the Prize amount.&amp;nbsp; (I forced all of the Prize amounts to be unique values by adding a very small unique number to each one in the load editor, thereby allowing the FieldValue function to work properly.)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I also thought about set analysis, but I think I read that this does not work with unjoined tables (check posting "pick rating on the fly using calculated score").&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It seems like this would be such a simple problem - I could do this in Excel quite easily, and am starting to wonder if this is even possible in Qlik Sense.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any suggestions?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 31 Jan 2017 18:41:58 GMT</pubDate>
    <dc:creator />
    <dc:date>2017-01-31T18:41:58Z</dc:date>
    <item>
      <title>Select values from an unjoined table using calculated values in a chart</title>
      <link>https://community.qlik.com/t5/App-Development/Select-values-from-an-unjoined-table-using-calculated-values-in/m-p/1268348#M26024</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have struggled with this issue for a few days with no real success, so it looks like I need expert advice.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My task is to pull in detailed records, summarize those records and compute subtotals in a chart.&amp;nbsp; Then based on the summarized subtotals, go out to another (unjoined) table, and select "reward" amounts.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My summarized table looks like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" width="1365"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD height="20" width="105"&gt;Dealer Name&lt;/TD&gt;&lt;TD width="105"&gt;Dlr #&lt;/TD&gt;&lt;TD width="105"&gt;Phone&lt;/TD&gt;&lt;TD width="105"&gt;State&lt;/TD&gt;&lt;TD width="105"&gt;Owner&lt;/TD&gt;&lt;TD class="xl63" width="105"&gt;Appl #&lt;/TD&gt;&lt;TD class="xl64" width="105"&gt;Appl $&lt;/TD&gt;&lt;TD class="xl63" width="105"&gt;Approve #&lt;/TD&gt;&lt;TD class="xl64" width="105"&gt;Approve $&lt;/TD&gt;&lt;TD class="xl63" width="105"&gt;Purch #&lt;/TD&gt;&lt;TD class="xl64" width="105"&gt;Purch $&lt;/TD&gt;&lt;TD class="xl65" width="105"&gt;Funded %&lt;/TD&gt;&lt;TD class="xl66" width="105"&gt;Prize $&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="20"&gt;XYZ&lt;/TD&gt;&lt;TD&gt;2005&lt;/TD&gt;&lt;TD&gt;123-456-7890&lt;/TD&gt;&lt;TD&gt;FL&lt;/TD&gt;&lt;TD&gt;Owner Name&lt;/TD&gt;&lt;TD align="right" class="xl63"&gt;111&lt;/TD&gt;&lt;TD align="right" class="xl64"&gt;$412,206.00&lt;/TD&gt;&lt;TD align="right" class="xl63"&gt;86&lt;/TD&gt;&lt;TD align="right" class="xl64"&gt;$319,868.00&lt;/TD&gt;&lt;TD align="right" class="xl63"&gt;64&lt;/TD&gt;&lt;TD align="right" class="xl64"&gt;$238,949.00&lt;/TD&gt;&lt;TD align="right" class="xl65"&gt;74.4%&lt;/TD&gt;&lt;TD align="right" class="xl67"&gt;600.00&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There will be several rows in this table.&amp;nbsp; For each row, I would want to lookup the Purch $ and Funded % (these are master measures with somewhat involved computations), in another unjoined table of rewards.&amp;nbsp; In this made up example, since the Purch $ is between 200,000 and 250,000, and the Funded % is greater than 60% the lookup reward would be 600.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here are some of the things that I have considered.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Qlik Sense has a lookup function, but this does not work in the chart environment.&amp;nbsp; I am unable to lookup these values in the load editor as I am starting with detail (loan) records and the summary (by dealer) is done at the chart level.&amp;nbsp; There are other functions that I also ruled out because they do not work at the chart level.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I thought the FieldIndex (and FieldValue) functions might be the answer.&amp;nbsp; To that end, I developed a way to combine the Purch $ and Funded % together by first rounding each to appropriate levels and then adding them together.&amp;nbsp; (In this made up example the combined value would be 200000.6)&amp;nbsp; I then can work with 2 columns in my reward table: a FundRatio field and a Prize field.&amp;nbsp; My latest Reward function looks like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if($(=$(vPurchD))&amp;lt;min(FundLow) or $(=$(vFundPerc))&amp;lt;min(RatioLow) ,0,&lt;/P&gt;&lt;P&gt;round(FieldValue('Prize',&lt;/P&gt;&lt;P&gt;FieldIndex('FundRatio',&lt;/P&gt;&lt;P&gt;num(if($(=$(vPurchD))&amp;gt;max(FundLow),max(FundLow),&lt;/P&gt;&lt;P&gt;if(floor($(=$(vPurchD))/50000)*50000&amp;lt;min(FundLow),min(FundLow),floor($(=$(vPurchD))/50000)*50000)&lt;/P&gt;&lt;P&gt;+if($(=$(vFundPerc))&amp;gt;max(RatioLow),max(RatioLow),floor($(=$(vFundPerc))*20)/20)&lt;/P&gt;&lt;P&gt;)))))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I switched to using variables in the Reward function in order to try and force recalculation.&amp;nbsp; While some of this function appears to work fine, the FieldIndex function does not pull a row number as it should.&amp;nbsp; I am now wondering if the FieldIndex function is intended to work as I would want it to.&amp;nbsp; Namely, I would like it to find the matching row number, then I could use this row number in the FieldValue function to find the Prize amount.&amp;nbsp; (I forced all of the Prize amounts to be unique values by adding a very small unique number to each one in the load editor, thereby allowing the FieldValue function to work properly.)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I also thought about set analysis, but I think I read that this does not work with unjoined tables (check posting "pick rating on the fly using calculated score").&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It seems like this would be such a simple problem - I could do this in Excel quite easily, and am starting to wonder if this is even possible in Qlik Sense.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any suggestions?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Jan 2017 18:41:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Select-values-from-an-unjoined-table-using-calculated-values-in/m-p/1268348#M26024</guid>
      <dc:creator />
      <dc:date>2017-01-31T18:41:58Z</dc:date>
    </item>
  </channel>
</rss>

