<?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 Caching variables in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Caching-variables/m-p/111058#M1292073</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey guys.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a simple question about performance and variable caching. Let's suppose I have these two expressions:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Expr1: Sum(Units)&lt;/P&gt;&lt;P&gt;Expr2: Sum(Dollars)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now, let's suppose I want to calculate a third expressión: Price.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Expr3: Sum(Dollars) / Sum(Units)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As far as I'm concerned, if I want optimum performance I would write the third expression like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Expr3: Column(2) / Column(1)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And then, QlikView would just use the previously calculated expressions (Expr1 and Expr2), optimizing performance (labeled aliases would also do the trick).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But what happens if I use variables? Let's suppose this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Expr1: $(vAmountOfUnits)&lt;/P&gt;&lt;P&gt;Expr2: $(vDollars)&lt;/P&gt;&lt;P&gt;Expr3: &lt;SPAN style="font-size: 13.3333px;"&gt;$(vDollars) / &lt;SPAN style="font-size: 13.3333px;"&gt;$(vAmountOfUnits)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;In the third expression, would QlikView use the previously cached $(vAmountOfUnits) and $(vDollars)? Or since it's a totally different expression (even if it contains parts of previous ones) it would have to calculate units and dollars again? (Obviously, I know I could go with the Column(x) approach here too, but my real situation is far more complex than this; this is just a very simple example to find out how QlikView deals with variables and caches).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;Thanks in advance!&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 26 Jan 2026 18:19:17 GMT</pubDate>
    <dc:creator>ramonarcusa36</dc:creator>
    <dc:date>2026-01-26T18:19:17Z</dc:date>
    <item>
      <title>Caching variables</title>
      <link>https://community.qlik.com/t5/QlikView/Caching-variables/m-p/111058#M1292073</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey guys.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a simple question about performance and variable caching. Let's suppose I have these two expressions:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Expr1: Sum(Units)&lt;/P&gt;&lt;P&gt;Expr2: Sum(Dollars)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now, let's suppose I want to calculate a third expressión: Price.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Expr3: Sum(Dollars) / Sum(Units)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As far as I'm concerned, if I want optimum performance I would write the third expression like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Expr3: Column(2) / Column(1)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And then, QlikView would just use the previously calculated expressions (Expr1 and Expr2), optimizing performance (labeled aliases would also do the trick).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But what happens if I use variables? Let's suppose this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Expr1: $(vAmountOfUnits)&lt;/P&gt;&lt;P&gt;Expr2: $(vDollars)&lt;/P&gt;&lt;P&gt;Expr3: &lt;SPAN style="font-size: 13.3333px;"&gt;$(vDollars) / &lt;SPAN style="font-size: 13.3333px;"&gt;$(vAmountOfUnits)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;In the third expression, would QlikView use the previously cached $(vAmountOfUnits) and $(vDollars)? Or since it's a totally different expression (even if it contains parts of previous ones) it would have to calculate units and dollars again? (Obviously, I know I could go with the Column(x) approach here too, but my real situation is far more complex than this; this is just a very simple example to find out how QlikView deals with variables and caches).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;Thanks in advance!&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Jan 2026 18:19:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Caching-variables/m-p/111058#M1292073</guid>
      <dc:creator>ramonarcusa36</dc:creator>
      <dc:date>2026-01-26T18:19:17Z</dc:date>
    </item>
    <item>
      <title>Re: Caching variables</title>
      <link>https://community.qlik.com/t5/QlikView/Caching-variables/m-p/111059#M1292077</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In your example, &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;Expr3: &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;$(vDollars) / &lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;$(vAmountOfUnits) will have the same caching as &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;Expr3: Sum(Dollars) / Sum(Units).&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-style: inherit; font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-weight: inherit;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-style: inherit; font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-weight: inherit;"&gt;When you use dollar expansion on a variable, the expansion itself does not get cached. Once it is expanded, everything is treated as normal. So basically the result of &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;Sum(Units) and &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;Sum(Dollars) &lt;/SPAN&gt;will be cached and &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;Sum(Dollars) / Sum(Units) will involve 2 cache lookups. Using variables to store the expressions do not change how caching will be done.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-style: inherit; font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-weight: inherit;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Nov 2018 00:22:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Caching-variables/m-p/111059#M1292077</guid>
      <dc:creator>mikevwang</dc:creator>
      <dc:date>2018-11-07T00:22:43Z</dc:date>
    </item>
  </channel>
</rss>

