<?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: Issue with set expression in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Issue-with-set-expression/m-p/1144457#M915706</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You don't need '=' while before RangeMax while using in the user defined function.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try like below:&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;$(vLogFn($(RangeMax(0,(sum({&amp;lt;Year=,DATE = {'$(=vTimeFrame)'}&amp;gt;}AMT)+&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;Year=,DATE = {'$(=vTimeFrame)'}&amp;gt;}AMT2))))))&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 13 May 2016 19:54:13 GMT</pubDate>
    <dc:creator />
    <dc:date>2016-05-13T19:54:13Z</dc:date>
    <item>
      <title>Issue with set expression</title>
      <link>https://community.qlik.com/t5/QlikView/Issue-with-set-expression/m-p/1144456#M915705</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;A href="https://community.qlik.com/qlik-users/96544" target="_blank"&gt;gwassenaar&lt;/A&gt;‌,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I couldn't attach the sample to the reply. So created a new thread.&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;The following expression returns 4,777M&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;=RangeMax(0,(sum({&amp;lt;Year=,DATE = {'$(=vTimeFrame)'}&amp;gt;}AMT)+&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;Year=,DATE = {'$(=vTimeFrame)'}&amp;gt;}AMT2)))/1000000&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;I want to convert my result to 3 sig fig's.&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;So I defined a variable as :&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;vLogFn = pick(floor(log10(fabs($1))/3)+1, num($1, '#,##0.'), num($1/1000, '###K'),num($1/1000000, '###M'),num($1/1000000000, '###B'))&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;And then rewrote my original expression as:&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;$(vLogFn($(=RangeMax(0,(sum({&amp;lt;Year=,DATE = {'$(=vTimeFrame)'}&amp;gt;}AMT)+&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;Year=,DATE = {'$(=vTimeFrame)'}&amp;gt;}AMT2))))))&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;But the result I got is pretty erroneous.&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Ideally, I was expecting something like 4.77B&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; Thanks in advance.&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;Regards,&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Roy&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Nov 2020 16:16:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Issue-with-set-expression/m-p/1144456#M915705</guid>
      <dc:creator />
      <dc:date>2020-11-25T16:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with set expression</title>
      <link>https://community.qlik.com/t5/QlikView/Issue-with-set-expression/m-p/1144457#M915706</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You don't need '=' while before RangeMax while using in the user defined function.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try like below:&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;$(vLogFn($(RangeMax(0,(sum({&amp;lt;Year=,DATE = {'$(=vTimeFrame)'}&amp;gt;}AMT)+&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;Year=,DATE = {'$(=vTimeFrame)'}&amp;gt;}AMT2))))))&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 May 2016 19:54:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Issue-with-set-expression/m-p/1144457#M915706</guid>
      <dc:creator />
      <dc:date>2016-05-13T19:54:13Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with set expression</title>
      <link>https://community.qlik.com/t5/QlikView/Issue-with-set-expression/m-p/1144458#M915707</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I can't reproduce it with the document you posted either. If I put the expression &lt;/P&gt;&lt;P&gt;&lt;EM&gt;=RangeMax(0,(sum({&amp;lt;Year=,TRANSACTION_DATE = {'$(=vTimeFrame)'}&amp;gt;}NTPV_AMT)+ &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;sum({&amp;lt;Year=,TRANSACTION_DATE = {'$(=vTimeFrame)'}&amp;gt;}NATIVE_TPV)))&lt;/EM&gt; in a textbox it returns 3835776.55. If I put that same expression in a variable vExp and create another textbox using your vLogFunction in an expression =$(vLogFunction($(vExp))) then the output is 3.84M. If I use the expression =$(vLogFunction($(vExp)*1234)) it returns 4.73B. So, your vLogFunction works fine afaict.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 14 May 2016 12:29:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Issue-with-set-expression/m-p/1144458#M915707</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2016-05-14T12:29:28Z</dc:date>
    </item>
  </channel>
</rss>

