<?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: Question about expression in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Question-about-expression/m-p/1221188#M390428</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yep, likely better based on what I saw, and on my assumptions (not knowledge) about how QlikView works. Also agreed that you should test it yourself. But there would be even faster approaches involving data model changes if neither performs well enough. I'm not at all an expert on regionalization and currencies, but I'd think you'd want to have an actual Currency field that connects you to a Cost, rather than having separate costs for each currency. Something like this as a new table added to your data model:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;Transaction ID, Currency, Cost&lt;BR /&gt;12345, USD, 500&lt;BR /&gt;12345, LBP, 750000&lt;BR /&gt;23456, USD, 100&lt;BR /&gt;23456, LBP, 150000&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;Currency, Format, any other currency information&lt;BR /&gt;USD, $#,##0.00;($#,##0.00)&lt;BR /&gt;LBP, ‎#,##0LBP;-‎#,##0LBP&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And use the expression:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;money(sum({&amp;lt;TrxType={'Sales'},DocType={'I'}&amp;gt;} Cost),Format)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You probably won't notice any performance difference, but at least it's a simpler expression. For performance, maybe extend it like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;Transaction ID, Currency, Cost, SalesICost&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;12345, USD, 500, 500&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;12345, LBP, 750000, 750000&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;23456, USD, 100, null()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;23456, LBP, 150000, null()&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And use the expression:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;money(sum(SalesICost),Format)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I suspect it won't run &lt;EM&gt;much&lt;/EM&gt; faster, but I suspect it will still at least be measurably faster. But mostly, I prefer my complexity be in the script rather than in the expressions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But again, I'm not even close to an expert in regionalization and currencies. Our company does all business and all reporting in a single currency, a single language. You could probably find better suggestions than the above with some searching on the forum for how people have handled currencies.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 07 Dec 2016 17:17:17 GMT</pubDate>
    <dc:creator>johnw</dc:creator>
    <dc:date>2016-12-07T17:17:17Z</dc:date>
    <item>
      <title>Question about expression</title>
      <link>https://community.qlik.com/t5/QlikView/Question-about-expression/m-p/1221181#M390421</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello which approach is better?&lt;/P&gt;&lt;P&gt;if( vSelectedCurrency = 'USD'&lt;/P&gt;&lt;P&gt;,SUM({&amp;lt;TrxType={'Sales'},DocType={'I'}&amp;gt;}CostUSD)&lt;/P&gt;&lt;P&gt;,SUM({&amp;lt;TrxType={'Sales'},DocType={'I'}&amp;gt;}CostLBP)&lt;/P&gt;&lt;P&gt;)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;SUM({&amp;lt;TrxType={'Sales'},DocType={'I'}&amp;gt;} &lt;SPAN style="font-size: 13.3333px;"&gt;if( vSelectedCurrency = 'USD',&lt;/SPAN&gt; CostUSD, CostLBP))&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Dec 2016 14:26:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Question-about-expression/m-p/1221181#M390421</guid>
      <dc:creator>ali_hijazi</dc:creator>
      <dc:date>2016-12-07T14:26:37Z</dc:date>
    </item>
    <item>
      <title>Re: Question about expression</title>
      <link>https://community.qlik.com/t5/QlikView/Question-about-expression/m-p/1221182#M390422</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/qlik-users/2226"&gt;johnw&lt;/A&gt;‌ did some testing and it seems that from his testing results&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;if( vSelectedCurrency = 'USD'&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;,SUM({&amp;lt;TrxType={'Sales'},DocType={'I'}&amp;gt;}CostUSD)&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;,SUM({&amp;lt;TrxType={'Sales'},DocType={'I'}&amp;gt;}CostLBP)&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;)&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;should be better&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;A href="https://community.qlik.com/message/1167348"&gt;Re: IF vs Pick Match&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Dec 2016 14:31:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Question-about-expression/m-p/1221182#M390422</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2016-12-07T14:31:32Z</dc:date>
    </item>
    <item>
      <title>Re: Question about expression</title>
      <link>https://community.qlik.com/t5/QlikView/Question-about-expression/m-p/1221183#M390423</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;But I would suggest you to do your own testing as well.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Dec 2016 14:32:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Question-about-expression/m-p/1221183#M390423</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2016-12-07T14:32:59Z</dc:date>
    </item>
    <item>
      <title>Re: Question about expression</title>
      <link>https://community.qlik.com/t5/QlikView/Question-about-expression/m-p/1221184#M390424</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This one:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pick(Match( $(vSelectedCurrency), 'USD')+1, &lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ,SUM({&amp;lt;TrxType={'Sales'},DocType={'I'}&amp;gt;}CostLBP)&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ,SUM({&amp;lt;TrxType={'Sales'},DocType={'I'}&amp;gt;}CostUSD)&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Dec 2016 14:33:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Question-about-expression/m-p/1221184#M390424</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2016-12-07T14:33:57Z</dc:date>
    </item>
    <item>
      <title>Re: Question about expression</title>
      <link>https://community.qlik.com/t5/QlikView/Question-about-expression/m-p/1221185#M390425</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try it yourself&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for each expression check the calc time in Sheet Properties &amp;gt;&amp;gt; Objects tab&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="242575.PNG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/145916_242575.PNG" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;try applying multiple filters and repeat the same with the other expression&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Dec 2016 14:35:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Question-about-expression/m-p/1221185#M390425</guid>
      <dc:creator>vinieme12</dc:creator>
      <dc:date>2016-12-07T14:35:29Z</dc:date>
    </item>
    <item>
      <title>Re: Question about expression</title>
      <link>https://community.qlik.com/t5/QlikView/Question-about-expression/m-p/1221186#M390426</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Be very careful when doing this. QlikView is a master at caching results or partial results. When I check calc times, I always do so by first closing QlikView to clear the cache, then reopening QlikView, reopening my document, and then going to the chart. Be careful even then, as you might have something on the tab you open that could cache data for the chart of interest. So I ALSO open to an empty tab, and then switch to a tab that has nothing but the object of interest. Also do it a few times to see if the CalcTime stays steady, or varies a lot. All those warnings aside, yes, the CalcTime is very valuable for performance tuning.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Dec 2016 16:54:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Question-about-expression/m-p/1221186#M390426</guid>
      <dc:creator>johnw</dc:creator>
      <dc:date>2016-12-07T16:54:54Z</dc:date>
    </item>
    <item>
      <title>Re: Question about expression</title>
      <link>https://community.qlik.com/t5/QlikView/Question-about-expression/m-p/1221187#M390427</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I wish there was a way to automate this kind of performance testing. I guess Rob's Document Analyzer kind of does this, but I would have liked a tool just for performance testing&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Dec 2016 16:57:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Question-about-expression/m-p/1221187#M390427</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2016-12-07T16:57:59Z</dc:date>
    </item>
    <item>
      <title>Re: Question about expression</title>
      <link>https://community.qlik.com/t5/QlikView/Question-about-expression/m-p/1221188#M390428</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yep, likely better based on what I saw, and on my assumptions (not knowledge) about how QlikView works. Also agreed that you should test it yourself. But there would be even faster approaches involving data model changes if neither performs well enough. I'm not at all an expert on regionalization and currencies, but I'd think you'd want to have an actual Currency field that connects you to a Cost, rather than having separate costs for each currency. Something like this as a new table added to your data model:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;Transaction ID, Currency, Cost&lt;BR /&gt;12345, USD, 500&lt;BR /&gt;12345, LBP, 750000&lt;BR /&gt;23456, USD, 100&lt;BR /&gt;23456, LBP, 150000&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;Currency, Format, any other currency information&lt;BR /&gt;USD, $#,##0.00;($#,##0.00)&lt;BR /&gt;LBP, ‎#,##0LBP;-‎#,##0LBP&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And use the expression:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;money(sum({&amp;lt;TrxType={'Sales'},DocType={'I'}&amp;gt;} Cost),Format)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You probably won't notice any performance difference, but at least it's a simpler expression. For performance, maybe extend it like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;Transaction ID, Currency, Cost, SalesICost&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;12345, USD, 500, 500&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;12345, LBP, 750000, 750000&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;23456, USD, 100, null()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;23456, LBP, 150000, null()&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And use the expression:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;money(sum(SalesICost),Format)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I suspect it won't run &lt;EM&gt;much&lt;/EM&gt; faster, but I suspect it will still at least be measurably faster. But mostly, I prefer my complexity be in the script rather than in the expressions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But again, I'm not even close to an expert in regionalization and currencies. Our company does all business and all reporting in a single currency, a single language. You could probably find better suggestions than the above with some searching on the forum for how people have handled currencies.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Dec 2016 17:17:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Question-about-expression/m-p/1221188#M390428</guid>
      <dc:creator>johnw</dc:creator>
      <dc:date>2016-12-07T17:17:17Z</dc:date>
    </item>
    <item>
      <title>Re: Question about expression</title>
      <link>https://community.qlik.com/t5/QlikView/Question-about-expression/m-p/1221189#M390429</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It might be easier than what I'm doing. I think you can turn off caching, and then I'm guessing all your calc times would be comparable. Set caching to 0% on the User preferences, general, working set limits. The help text seems to suggest that would work, but I've not tried it, and I'm not certain. Definitely remember to change it back when you're done, or you'll be wondering why QlikView is suddenly so slow!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I see that Rob's Document Analyzer has calc times for the objects, but I imagine those are the actual calc times, not the calc times with caching off.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hmmm, though maybe caching off isn't what we want either. Some expressions may, in and of themselves, build and used cached data, like if(sum(Sales),sum(Sales)). With caching, it would only do the sum once. Without, I'm guessing it would be forced to do it twice, which isn't what we're looking to see. Ugh. So maybe leaving caching on and how I'm doing it is the best we can do. I'd like there to be a better way.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Dec 2016 17:27:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Question-about-expression/m-p/1221189#M390429</guid>
      <dc:creator>johnw</dc:creator>
      <dc:date>2016-12-07T17:27:23Z</dc:date>
    </item>
  </channel>
</rss>

