<?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: Get record value based on expression calculation in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Get-record-value-based-on-expression-calculation/m-p/131101#M457805</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;May be like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If(Column(1) &amp;gt;= 0 and Column(1) &amp;lt;= 2500, "5",&lt;/P&gt;&lt;P&gt;if(Column(1) &amp;gt; 2500 and Column(1) &amp;lt;= 12500, "10",&lt;/P&gt;&lt;P&gt;If(Column(1) &amp;gt; 12500 and Column(1) &amp;lt;= 20000, "15")))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Column(1) refers SalesAmount.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 13 Aug 2018 12:32:02 GMT</pubDate>
    <dc:creator>BalaBhaskar_Qlik</dc:creator>
    <dc:date>2018-08-13T12:32:02Z</dc:date>
    <item>
      <title>Get record value based on expression calculation</title>
      <link>https://community.qlik.com/t5/QlikView/Get-record-value-based-on-expression-calculation/m-p/131099#M457803</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a chart in where I calculate the SalesAmount per Salesperson.&lt;/P&gt;&lt;P&gt;This is a calculation based on a lot of different sales figures, filtered with set analysis to get the correct result.&lt;/P&gt;&lt;P&gt;It is not doable via scripting, so in my script, I do not have the correct SalesAmount per Salesperson&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this is an example of the result of the calculation in the chart, but be aware, this is a calculation of a lot of different sales amounts:&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" height="99" style="border: 1px solid #000000; width: 231px; height: 74px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;Salesperson&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;SalesAmount&lt;/STRONG&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;Dave&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;5000&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;Jef&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;10000&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;Michael&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;15000&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now I have a table (Excel spreadsheet) where I upload a "SalesAmount" and "Bonuspercentage".&lt;/P&gt;&lt;P&gt;(so salesamount between 0-2500 = 5%, between 2501-12500 = 10%, between 12501-20000 =15%)&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" height="99" style="border: 1px solid #000000; width: 209px; height: 51px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;SalesAmount&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;BonusPercentage&lt;/STRONG&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;2500&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;5&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;12500&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;10&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;20000&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;15&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to link them together, so as a final result I would like to see:&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" height="99" style="border: 1px solid #000000; width: 212px; height: 64px;" width="294"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;Salesperson&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;SalesAmount&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;BonusPercentage&lt;/STRONG&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;Dave&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;5000&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;10&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;Jef&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;10000&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;10&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;Michael&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;15000&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;15&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a way to get the correct "BonusPercentage" based on the calculated field "SalesAmount" in the chart?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Aug 2018 07:20:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Get-record-value-based-on-expression-calculation/m-p/131099#M457803</guid>
      <dc:creator>wim_rijken</dc:creator>
      <dc:date>2018-08-13T07:20:27Z</dc:date>
    </item>
    <item>
      <title>Re: Get record value based on expression calculation</title>
      <link>https://community.qlik.com/t5/QlikView/Get-record-value-based-on-expression-calculation/m-p/131100#M457804</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I got a little lost trying to do exactly what you said, so I tried a slight workaround. Instead of using a table with SalesAmount and BonusPercentage, I used a table with BonusStart, BonusEnd, and Bonus Percentage. Hopefully you can make that adjustment in your Excel, but if not, you can use Peek() to do it in your script. There may be a way to get this done with your original data structure but I'm not sure how.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Load * Inline [&lt;/P&gt;&lt;P&gt;Salesperson,&amp;nbsp;&amp;nbsp;&amp;nbsp; SalesAmount&lt;/P&gt;&lt;P&gt;Dave,&amp;nbsp;&amp;nbsp;&amp;nbsp; 5000&lt;/P&gt;&lt;P&gt;Jef,&amp;nbsp;&amp;nbsp;&amp;nbsp; 10000&lt;/P&gt;&lt;P&gt;Michael,&amp;nbsp;&amp;nbsp;&amp;nbsp; 15000&lt;/P&gt;&lt;P&gt;Wile E. Coyote, 1000];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Load * Inline [&lt;/P&gt;&lt;P&gt;BonusStart, BonusEnd, BonusPercentage&lt;/P&gt;&lt;P&gt;0, 2500,&amp;nbsp;&amp;nbsp;&amp;nbsp; 5&lt;/P&gt;&lt;P&gt;2501, 12500,&amp;nbsp;&amp;nbsp;&amp;nbsp; 10&lt;/P&gt;&lt;P&gt;12501, 20000,&amp;nbsp;&amp;nbsp;&amp;nbsp; 15&lt;/P&gt;&lt;P&gt;];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note that this is a data island - it does &lt;STRONG&gt;not&lt;/STRONG&gt; connect to SalesAmount (which you don't want it to). I then used the following expression:&lt;/P&gt;&lt;P&gt;Sum(aggr(if(Sum(SalesAmount)&amp;gt;=BonusStart AND Sum(SalesAmount) &amp;lt;= BonusEnd,BonusPercentage),BonusStart,Salesperson))&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="210636" alt="" class="jive-image image-1" height="75" src="https://community.qlik.com/legacyfs/online/210636_pastedImage_0.png" style="width: 762.295px; height: 75px;" width="762" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note that this will also work if the bonus table is connected to the sales table via dimensions such as Salesperson:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Load * Inline [&lt;/P&gt;&lt;P&gt;Salesperson, BonusStart, BonusEnd, BonusPercentage&lt;/P&gt;&lt;P&gt;Dave, 0, 2500,&amp;nbsp;&amp;nbsp;&amp;nbsp; 5&lt;/P&gt;&lt;P&gt;Dave, 2501, 12500,&amp;nbsp;&amp;nbsp;&amp;nbsp; 10&lt;/P&gt;&lt;P&gt;Dave, 12501, 20000,&amp;nbsp;&amp;nbsp;&amp;nbsp; 15&lt;/P&gt;&lt;P&gt;Jef, 0, 2500,&amp;nbsp;&amp;nbsp;&amp;nbsp; 11&lt;/P&gt;&lt;P&gt;Jef, 2501, 12500,&amp;nbsp;&amp;nbsp;&amp;nbsp; 22&lt;/P&gt;&lt;P&gt;Jef, 12501, 20000,&amp;nbsp;&amp;nbsp;&amp;nbsp; 33&lt;/P&gt;&lt;P&gt;Michael, 0, 6666,&amp;nbsp;&amp;nbsp;&amp;nbsp; 6&lt;/P&gt;&lt;P&gt;Michael, 6667, 66666,&amp;nbsp;&amp;nbsp;&amp;nbsp; 66&lt;/P&gt;&lt;P&gt;Michael, 66667, 666666,&amp;nbsp;&amp;nbsp;&amp;nbsp; 666&lt;/P&gt;&lt;P&gt;];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="210637" alt="" class="jive-image image-2" height="72" src="https://community.qlik.com/legacyfs/online/210637_pastedImage_1.png" style="width: 731.803px; height: 72px;" width="732" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Aug 2018 08:44:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Get-record-value-based-on-expression-calculation/m-p/131100#M457804</guid>
      <dc:creator>Or</dc:creator>
      <dc:date>2018-08-13T08:44:13Z</dc:date>
    </item>
    <item>
      <title>Re: Get record value based on expression calculation</title>
      <link>https://community.qlik.com/t5/QlikView/Get-record-value-based-on-expression-calculation/m-p/131101#M457805</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;May be like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If(Column(1) &amp;gt;= 0 and Column(1) &amp;lt;= 2500, "5",&lt;/P&gt;&lt;P&gt;if(Column(1) &amp;gt; 2500 and Column(1) &amp;lt;= 12500, "10",&lt;/P&gt;&lt;P&gt;If(Column(1) &amp;gt; 12500 and Column(1) &amp;lt;= 20000, "15")))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Column(1) refers SalesAmount.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Aug 2018 12:32:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Get-record-value-based-on-expression-calculation/m-p/131101#M457805</guid>
      <dc:creator>BalaBhaskar_Qlik</dc:creator>
      <dc:date>2018-08-13T12:32:02Z</dc:date>
    </item>
  </channel>
</rss>

