<?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: Improve expression in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Improve-expression/m-p/956971#M967798</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;An improvement could be to change the kind of rate which you calculate from:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(CurrentYear - LastYear) / LastYear&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; to&lt;/P&gt;&lt;P&gt;CurrentYear / LastYear&lt;/P&gt;&lt;P&gt;/* or reversed an/or multiplied with 100 or with (-1 + result) or (result -1) to change the direction from the rate*/&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;with them you could reduce the calculation-steps from four to two.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Further possible is to transfer your week-selections check into a variable which then returned either the year- or the weekyear-expression which meant those check would be only done one time globally and not for each possible record.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Another possibility might be to create boolean flag-fields for current/last year within the script (disadvantage: (really) isn't flexible against user-selections anymore) and use then simplyfied expressions like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum(&lt;STRONG&gt;[Prix de vente TTC]&lt;/STRONG&gt; * CurrentYearFlag)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 29 Sep 2015 10:14:45 GMT</pubDate>
    <dc:creator>marcus_sommer</dc:creator>
    <dc:date>2015-09-29T10:14:45Z</dc:date>
    <item>
      <title>Improve expression</title>
      <link>https://community.qlik.com/t5/QlikView/Improve-expression/m-p/956970#M967797</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How can I improve the following expression &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;H5&gt;(if(IsNull(GetFieldSelections(Week,'*')),(Sum({$&amp;lt;Year={$(=max(Year))}&amp;gt;}[Prix de vente TTC])-Sum({$&amp;lt;Year={$(=max(Year-1))}&amp;gt;}[Prix de vente TTC]))/Sum({$&amp;lt;Year={$(=max(Year-1))}&amp;gt;}[Prix de vente TTC]),&lt;/H5&gt;&lt;H5&gt;(Sum({$&amp;lt;Weekyear= {$(=max(Weekyear))}&amp;gt;}[Prix de vente TTC])-Sum({$&amp;lt;Weekyear= {$(=max(Weekyear-1))}&amp;gt;}[Prix de vente TTC]))/Sum({$&amp;lt;Weekyear= {$(=max(Weekyear-1))}&amp;gt;}[Prix de vente TTC])))&lt;/H5&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Sep 2015 09:37:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Improve-expression/m-p/956970#M967797</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-09-29T09:37:27Z</dc:date>
    </item>
    <item>
      <title>Re: Improve expression</title>
      <link>https://community.qlik.com/t5/QlikView/Improve-expression/m-p/956971#M967798</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;An improvement could be to change the kind of rate which you calculate from:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(CurrentYear - LastYear) / LastYear&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; to&lt;/P&gt;&lt;P&gt;CurrentYear / LastYear&lt;/P&gt;&lt;P&gt;/* or reversed an/or multiplied with 100 or with (-1 + result) or (result -1) to change the direction from the rate*/&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;with them you could reduce the calculation-steps from four to two.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Further possible is to transfer your week-selections check into a variable which then returned either the year- or the weekyear-expression which meant those check would be only done one time globally and not for each possible record.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Another possibility might be to create boolean flag-fields for current/last year within the script (disadvantage: (really) isn't flexible against user-selections anymore) and use then simplyfied expressions like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum(&lt;STRONG&gt;[Prix de vente TTC]&lt;/STRONG&gt; * CurrentYearFlag)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Sep 2015 10:14:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Improve-expression/m-p/956971#M967798</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2015-09-29T10:14:45Z</dc:date>
    </item>
  </channel>
</rss>

