<?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 set analysis and if statements in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/set-analysis-and-if-statements/m-p/215852#M69257</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;I'm trying to do this;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if([Financing cost start date]&amp;lt;vStartDate,&lt;/P&gt;&lt;P&gt;sum({$&amp;lt;bk_account={1401,2990}, trans_date={[Financing cost start date]}&amp;gt;} trans_amt_sek/100)&lt;/P&gt;&lt;P&gt;* ((0.06/360)*(if([Financing cost end date]&amp;lt;vStartDate,[Financing cost end date], vStartDate) - [Financing cost start date])), 'N/A')&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;/P&gt;&lt;P&gt;But. My guess is that the set analysis doesn't like "[Financing cost start date]" which is pre-defined in another expression in the same table. It consist of a lot of if statments and i tried to replace the defined [Financing cost start date] with the huge if-statement as well but i doesn't seem to work. How do i do this? Can i use an if statment in a set anaysis and how?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//A.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 14 Apr 2011 13:28:54 GMT</pubDate>
    <dc:creator />
    <dc:date>2011-04-14T13:28:54Z</dc:date>
    <item>
      <title>set analysis and if statements</title>
      <link>https://community.qlik.com/t5/QlikView/set-analysis-and-if-statements/m-p/215852#M69257</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;I'm trying to do this;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if([Financing cost start date]&amp;lt;vStartDate,&lt;/P&gt;&lt;P&gt;sum({$&amp;lt;bk_account={1401,2990}, trans_date={[Financing cost start date]}&amp;gt;} trans_amt_sek/100)&lt;/P&gt;&lt;P&gt;* ((0.06/360)*(if([Financing cost end date]&amp;lt;vStartDate,[Financing cost end date], vStartDate) - [Financing cost start date])), 'N/A')&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;/P&gt;&lt;P&gt;But. My guess is that the set analysis doesn't like "[Financing cost start date]" which is pre-defined in another expression in the same table. It consist of a lot of if statments and i tried to replace the defined [Financing cost start date] with the huge if-statement as well but i doesn't seem to work. How do i do this? Can i use an if statment in a set anaysis and how?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//A.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Apr 2011 13:28:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/set-analysis-and-if-statements/m-p/215852#M69257</guid>
      <dc:creator />
      <dc:date>2011-04-14T13:28:54Z</dc:date>
    </item>
    <item>
      <title>set analysis and if statements</title>
      <link>https://community.qlik.com/t5/QlikView/set-analysis-and-if-statements/m-p/215853#M69258</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;/P&gt;&lt;DIV&gt;&lt;P&gt;Hi Anykay,&lt;/P&gt;&lt;P&gt;You're right, the problem is that you can't directly use if-statements in set analysis. But you can use dollar-sign expansion to evaluate a function.&lt;/P&gt;&lt;P&gt;For example: sum( {&amp;lt;trans_date={'$(=if(Condition,01/01/2011,02/02/2011))'}&amp;gt;} trans_amt_sek )&lt;/P&gt;&lt;P&gt;The syntax is to use $(= function() ), and QV will replace the function with the result of it.&lt;/P&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Hope this helps.&lt;/DIV&gt;&lt;DIV&gt;Regards,&lt;/DIV&gt;&lt;DIV&gt;Fernando&lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Apr 2011 17:34:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/set-analysis-and-if-statements/m-p/215853#M69258</guid>
      <dc:creator>fosuzuki</dc:creator>
      <dc:date>2011-04-14T17:34:39Z</dc:date>
    </item>
    <item>
      <title>Re: set analysis and if statements</title>
      <link>https://community.qlik.com/t5/QlikView/set-analysis-and-if-statements/m-p/215854#M69259</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-size: 10pt;"&gt;I did something similar with "count", by using the "if" after the set and before the field that you want to sum or count:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code"&gt;&lt;P&gt;= count ({$&amp;lt;[Policy Submit Date] = {'&amp;gt;=$(=AddYears(Min([Appt Date]), -1)) &amp;lt; $(=Min([Appt Date]))'},&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [Product Mktg Attendee] = , [Activity Completed] = , [Activity Cancelled] = , [Year] = , [Month] = , [Date] = &amp;gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; distinct &lt;STRONG&gt;if([Papers Only] = 'Y' and DateType = 'Policy Submit Date',&lt;/STRONG&gt; [Policy #]))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Oct 2011 18:16:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/set-analysis-and-if-statements/m-p/215854#M69259</guid>
      <dc:creator />
      <dc:date>2011-10-04T18:16:18Z</dc:date>
    </item>
    <item>
      <title>Re: set analysis and if statements</title>
      <link>https://community.qlik.com/t5/QlikView/set-analysis-and-if-statements/m-p/215855#M69260</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Annika&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your guess is correct - you cannot use a value from another column of the table inside a set expression. Remember that set expressions are evaluated before the table is calculated, and [Financing cost start date] does not exist at that time. Apart from that I don't see any problems with your expression.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If your data set is not too large, you can convert the set expression to if statements. I think this should do it&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code"&gt;&lt;P&gt;if([Financing cost start date] &amp;lt; vStartDate,&lt;/P&gt;&lt;P&gt;Sum(If(Match(bk_account, 1401,2990) AND trans_date=[Financing cost start date], trans_amt_sek/100)&lt;/P&gt;&lt;P&gt;* ((0.06/360)*(if([Financing cost end date]&amp;lt;vStartDate,[Financing cost end date], vStartDate) - [Financing cost start date]))), 'N/A')&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Set analysis is much better perfoming than sum-if expressions, so this may be slow if you have a large data set and/or complex model.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps&lt;/P&gt;&lt;P&gt;Jonathan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Oct 2011 20:02:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/set-analysis-and-if-statements/m-p/215855#M69260</guid>
      <dc:creator>jonathandienst</dc:creator>
      <dc:date>2011-10-04T20:02:21Z</dc:date>
    </item>
  </channel>
</rss>

