<?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: Set expression to multiply factor based on range in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Set-expression-to-multiply-factor-based-on-range/m-p/1328959#M28939</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is there a possibility to do this without hard-coding the factor values; cause the factor values can change.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 21 Jun 2017 07:07:11 GMT</pubDate>
    <dc:creator />
    <dc:date>2017-06-21T07:07:11Z</dc:date>
    <item>
      <title>Set expression to multiply factor based on range</title>
      <link>https://community.qlik.com/t5/App-Development/Set-expression-to-multiply-factor-based-on-range/m-p/1328957#M28937</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Below are the table structures I have:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Events:&lt;/P&gt;&lt;P&gt;Load * Inline [&lt;/P&gt;&lt;P&gt;Event, EventDate, EventAmount, EventOnTime, EventHappened&lt;/P&gt;&lt;P&gt;1, 1/1/2017, $100, 1, 1&lt;/P&gt;&lt;P&gt;2, 1/1/2017, $200, 0, 1&lt;/P&gt;&lt;P&gt;3, 1/2/2017, $50, 0, 1&lt;/P&gt;&lt;P&gt;4, 1/31/2017, $500, 1, 1&lt;/P&gt;&lt;P&gt;];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Percent of events that happened on time for the Month of Jan 2017 would be (1+0+0+1)/4=50% (Let this number be called P)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Factor:&lt;/P&gt;&lt;P&gt;Load * Inline [&lt;/P&gt;&lt;P&gt;FactorType, MinPercent, MaxPercent, Factor&lt;/P&gt;&lt;P&gt;A, 0%, 25%, 100%&lt;/P&gt;&lt;P&gt;A, 26%, 75%, 60%&lt;/P&gt;&lt;P&gt;A, 76%, 100%, 0%&lt;/P&gt;&lt;P&gt;]; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the visualization, I have created a line chart which shows the EventAmount by Month and for multiple Years. The chart looks something like like this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Capture.png" class="jive-image image-1" height="253" src="https://community.qlik.com/legacyfs/online/167565_Capture.png" style="font-size: 13.3333px;" width="522" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The actual requirement is to multiply the EventAmount by Factor based on the range in which "P" belongs. In this case, for Jan 2017- EventAmount($850)*Factor(60%)=$510. $510 is the number which has to be represented in the line chart.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How to write set expression for the above requirement?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;Deepika&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Jun 2017 05:12:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-expression-to-multiply-factor-based-on-range/m-p/1328957#M28937</guid>
      <dc:creator />
      <dc:date>2017-06-21T05:12:00Z</dc:date>
    </item>
    <item>
      <title>Re: Set expression to multiply factor based on range</title>
      <link>https://community.qlik.com/t5/App-Development/Set-expression-to-multiply-factor-based-on-range/m-p/1328958#M28938</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;try this expression:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=&lt;/P&gt;&lt;P&gt;if( &lt;/P&gt;&lt;P&gt;(aggr ( sum(EventOnTime), monthyear) / count(total EventOnTime) ) &amp;lt;=0.25, 1, if(&lt;/P&gt;&lt;P&gt;(aggr ( sum(EventOnTime), monthyear) / count(total EventOnTime) ) &amp;lt;=0.75, 0.6, if(&lt;/P&gt;&lt;P&gt;(aggr ( sum(EventOnTime), monthyear) / count(total EventOnTime) ) &amp;lt;=1, 0))) * EventAmount&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Jun 2017 07:00:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-expression-to-multiply-factor-based-on-range/m-p/1328958#M28938</guid>
      <dc:creator />
      <dc:date>2017-06-21T07:00:59Z</dc:date>
    </item>
    <item>
      <title>Re: Set expression to multiply factor based on range</title>
      <link>https://community.qlik.com/t5/App-Development/Set-expression-to-multiply-factor-based-on-range/m-p/1328959#M28939</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is there a possibility to do this without hard-coding the factor values; cause the factor values can change.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Jun 2017 07:07:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-expression-to-multiply-factor-based-on-range/m-p/1328959#M28939</guid>
      <dc:creator />
      <dc:date>2017-06-21T07:07:11Z</dc:date>
    </item>
    <item>
      <title>Re: Set expression to multiply factor based on range</title>
      <link>https://community.qlik.com/t5/App-Development/Set-expression-to-multiply-factor-based-on-range/m-p/1328960#M28940</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;you can add these tables, so the expression is not hardcoded in the dashboard but in the script, it is hard to link it to the Factor table hence there is no identifier to each range&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try these in the script:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Events1:&lt;/P&gt;&lt;P&gt;Load *,&lt;/P&gt;&lt;P&gt;MonthName(Date(EventDate)) as monthyear&lt;/P&gt;&lt;P&gt;resident Events;&lt;/P&gt;&lt;P&gt;drop table Events;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;test:&lt;/P&gt;&lt;P&gt;Load &lt;/P&gt;&lt;P&gt;monthyear,&lt;/P&gt;&lt;P&gt;sum(EventOnTime)/ count( EventOnTime) as Factor,&lt;/P&gt;&lt;P&gt;if( sum(EventOnTime)/ count( EventOnTime)&amp;lt;=0.25 , 1,&lt;/P&gt;&lt;P&gt;if(sum(EventOnTime)/ count( EventOnTime)&amp;lt;=0.75 ,0.6 ,&lt;/P&gt;&lt;P&gt;if(sum(EventOnTime)/ count( EventOnTime)&amp;lt;=1 ,0))) as Total11&lt;/P&gt;&lt;P&gt;resident Events1&lt;/P&gt;&lt;P&gt;group By monthyear;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Jun 2017 07:25:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-expression-to-multiply-factor-based-on-range/m-p/1328960#M28940</guid>
      <dc:creator />
      <dc:date>2017-06-21T07:25:07Z</dc:date>
    </item>
  </channel>
</rss>

