<?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: IF Statement Calculation in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/IF-Statement-Calculation/m-p/1272861#M461398</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Zeth,&lt;/P&gt;&lt;P&gt;It's hard to say without more info.&amp;nbsp; Making some assumptions you could do something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data:&lt;/P&gt;&lt;P&gt;LOAD * INLINE [&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Team, Type, Number&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; A, Actual, 4&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; A, Actual, 3&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; A, FTE, 6&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; B, Actual, 1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; B, Actual, 2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; B, FTE, 4&lt;/P&gt;&lt;P&gt;];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Summary:&lt;/P&gt;&lt;P&gt;load *,&lt;/P&gt;&lt;P&gt;if(Actual&amp;gt;FTE,'OVERSTAFFED','UNDERSTAFFED') as Status&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;load&lt;/P&gt;&lt;P&gt;Team,&lt;/P&gt;&lt;P&gt;Sum(ActualNbr) as Actual,&lt;/P&gt;&lt;P&gt;Sum(FTENbr) as FTE&lt;/P&gt;&lt;P&gt;group by Team&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;load&lt;/P&gt;&lt;P&gt;Team,&lt;/P&gt;&lt;P&gt;if(Type='Actual',Number,0) as ActualNbr,&lt;/P&gt;&lt;P&gt;if(Type='FTE',Number,0) as FTENbr&lt;/P&gt;&lt;P&gt;resident Data&lt;/P&gt;&lt;P&gt;; &lt;/P&gt;&lt;P&gt;////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////&lt;/P&gt;&lt;P&gt;It would give you an output like this.&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Capture.PNG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/149941_Capture.PNG" style="height: auto;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 18 Jan 2017 21:42:34 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2017-01-18T21:42:34Z</dc:date>
    <item>
      <title>IF Statement Calculation</title>
      <link>https://community.qlik.com/t5/QlikView/IF-Statement-Calculation/m-p/1272855#M461392</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have the following If statement in the load script but it is an invalid expression. Does anyone have any thoughts on how i can make this work? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; IF((Match(Type,'FTE') and sum(Number)) &amp;gt; (Match(Type,'ACTUAL') and sum(Number)),'OVERSTAFFED','UNDERSTAFFED')&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Jan 2017 19:41:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/IF-Statement-Calculation/m-p/1272855#M461392</guid>
      <dc:creator />
      <dc:date>2017-01-18T19:41:58Z</dc:date>
    </item>
    <item>
      <title>Re: IF Statement Calculation</title>
      <link>https://community.qlik.com/t5/QlikView/IF-Statement-Calculation/m-p/1272856#M461393</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You should set a flag for Type = FTE and using the Flag you can create a expression in UI.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Else you can use below the expression in UI&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if(sum({&amp;lt;Type={"FTE"}&amp;gt;}Number)&amp;gt;sum({&amp;lt;Type={"ACTUAL"}&amp;gt;}Number),'OVERSTAFFED','UNDERSTAFFED')&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Are you using the expression in Load statement or assigning the value to a variable?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Jan 2017 19:47:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/IF-Statement-Calculation/m-p/1272856#M461393</guid>
      <dc:creator>krishnacbe</dc:creator>
      <dc:date>2017-01-18T19:47:19Z</dc:date>
    </item>
    <item>
      <title>Re: IF Statement Calculation</title>
      <link>https://community.qlik.com/t5/QlikView/IF-Statement-Calculation/m-p/1272857#M461394</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am using it in the load statement, I know i can do it in the UI but i need it done in the load script. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Jan 2017 19:49:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/IF-Statement-Calculation/m-p/1272857#M461394</guid>
      <dc:creator />
      <dc:date>2017-01-18T19:49:01Z</dc:date>
    </item>
    <item>
      <title>Re: IF Statement Calculation</title>
      <link>https://community.qlik.com/t5/QlikView/IF-Statement-Calculation/m-p/1272858#M461395</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Zeth&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please, share your associative model data&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Jan 2017 19:54:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/IF-Statement-Calculation/m-p/1272858#M461395</guid>
      <dc:creator>handry_orozco</dc:creator>
      <dc:date>2017-01-18T19:54:29Z</dc:date>
    </item>
    <item>
      <title>Re: IF Statement Calculation</title>
      <link>https://community.qlik.com/t5/QlikView/IF-Statement-Calculation/m-p/1272859#M461396</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is a flat data table is one of my constraints.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Jan 2017 20:08:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/IF-Statement-Calculation/m-p/1272859#M461396</guid>
      <dc:creator />
      <dc:date>2017-01-18T20:08:07Z</dc:date>
    </item>
    <item>
      <title>Re: IF Statement Calculation</title>
      <link>https://community.qlik.com/t5/QlikView/IF-Statement-Calculation/m-p/1272860#M461397</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It won't work so easily in script with the reason of having aggregation involved, you may try as below - &lt;/P&gt;&lt;P&gt;1. First calculate sum(number) using where clause and group by clause in separate table&lt;/P&gt;&lt;P&gt;2. join the sum no to the old table so that sum field is available in all records&lt;/P&gt;&lt;P&gt;3. then compare the type field with the new sum field as you are trying to do.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;May not completely correct, if you share your script, can add something further.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Jan 2017 20:13:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/IF-Statement-Calculation/m-p/1272860#M461397</guid>
      <dc:creator>Digvijay_Singh</dc:creator>
      <dc:date>2017-01-18T20:13:45Z</dc:date>
    </item>
    <item>
      <title>Re: IF Statement Calculation</title>
      <link>https://community.qlik.com/t5/QlikView/IF-Statement-Calculation/m-p/1272861#M461398</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Zeth,&lt;/P&gt;&lt;P&gt;It's hard to say without more info.&amp;nbsp; Making some assumptions you could do something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data:&lt;/P&gt;&lt;P&gt;LOAD * INLINE [&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Team, Type, Number&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; A, Actual, 4&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; A, Actual, 3&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; A, FTE, 6&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; B, Actual, 1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; B, Actual, 2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; B, FTE, 4&lt;/P&gt;&lt;P&gt;];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Summary:&lt;/P&gt;&lt;P&gt;load *,&lt;/P&gt;&lt;P&gt;if(Actual&amp;gt;FTE,'OVERSTAFFED','UNDERSTAFFED') as Status&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;load&lt;/P&gt;&lt;P&gt;Team,&lt;/P&gt;&lt;P&gt;Sum(ActualNbr) as Actual,&lt;/P&gt;&lt;P&gt;Sum(FTENbr) as FTE&lt;/P&gt;&lt;P&gt;group by Team&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;load&lt;/P&gt;&lt;P&gt;Team,&lt;/P&gt;&lt;P&gt;if(Type='Actual',Number,0) as ActualNbr,&lt;/P&gt;&lt;P&gt;if(Type='FTE',Number,0) as FTENbr&lt;/P&gt;&lt;P&gt;resident Data&lt;/P&gt;&lt;P&gt;; &lt;/P&gt;&lt;P&gt;////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////&lt;/P&gt;&lt;P&gt;It would give you an output like this.&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Capture.PNG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/149941_Capture.PNG" style="height: auto;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Jan 2017 21:42:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/IF-Statement-Calculation/m-p/1272861#M461398</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-01-18T21:42:34Z</dc:date>
    </item>
  </channel>
</rss>

