<?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: Format pattern with conditional decimal in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Format-pattern-with-conditional-decimal/m-p/974825#M950349</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try this may be:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;=If(Len(Trim(SubField(NumberField, '.', 2))) &amp;gt; 2, Num(&lt;SPAN style="font-size: 13.3333px;"&gt;NumberField&lt;/SPAN&gt;, '#,##0.00'),&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt; If(Len(Trim(SubField(&lt;SPAN style="font-size: 13.3333px;"&gt;NumberField&lt;/SPAN&gt;, '.', 2))) = 1, Num(&lt;SPAN style="font-size: 13.3333px;"&gt;NumberField&lt;/SPAN&gt;, '#,##0.0'), Num(&lt;SPAN style="font-size: 13.3333px;"&gt;NumberField&lt;/SPAN&gt;, '#,##0')))&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 08 Dec 2015 21:48:33 GMT</pubDate>
    <dc:creator>sunny_talwar</dc:creator>
    <dc:date>2015-12-08T21:48:33Z</dc:date>
    <item>
      <title>Format pattern with conditional decimal</title>
      <link>https://community.qlik.com/t5/QlikView/Format-pattern-with-conditional-decimal/m-p/974824#M950348</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;IMG alt="qlik.JPG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/108404_qlik.JPG" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The image above shows my current display in a chart, currently setup as Expression Default in the Chart Properties (Number tab).&amp;nbsp; I would like to only show up to two decimal places when the decimal is not 0.&amp;nbsp; Ideally I would like to see:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3123.89&lt;/P&gt;&lt;P&gt;31911.27&lt;/P&gt;&lt;P&gt;450&lt;/P&gt;&lt;P&gt;72.42&lt;/P&gt;&lt;P&gt;1149.38&lt;/P&gt;&lt;P&gt;19468.14&lt;/P&gt;&lt;P&gt;471.25&lt;/P&gt;&lt;P&gt;14882.25&lt;/P&gt;&lt;P&gt;10428.75&lt;/P&gt;&lt;P&gt;14006.5&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I try to force the format pattern "Fixed to 2 decimals", it always shows .00 on the whole numbers and .#0 on the values that have only one decimal place.&amp;nbsp; Some of the decimals are very large, which is why I want to only show 2 decimal places.&amp;nbsp; If I use the round() function, it automatically tacks on two decimal places, even on whole numbers, so I'm still seeing .00 on values like 450 above.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is it possible in Qlik to only show a certain number of decimal places, but only when they are non-zero?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Dec 2015 21:38:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Format-pattern-with-conditional-decimal/m-p/974824#M950348</guid>
      <dc:creator>anothergreg</dc:creator>
      <dc:date>2015-12-08T21:38:24Z</dc:date>
    </item>
    <item>
      <title>Re: Format pattern with conditional decimal</title>
      <link>https://community.qlik.com/t5/QlikView/Format-pattern-with-conditional-decimal/m-p/974825#M950349</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try this may be:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;=If(Len(Trim(SubField(NumberField, '.', 2))) &amp;gt; 2, Num(&lt;SPAN style="font-size: 13.3333px;"&gt;NumberField&lt;/SPAN&gt;, '#,##0.00'),&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt; If(Len(Trim(SubField(&lt;SPAN style="font-size: 13.3333px;"&gt;NumberField&lt;/SPAN&gt;, '.', 2))) = 1, Num(&lt;SPAN style="font-size: 13.3333px;"&gt;NumberField&lt;/SPAN&gt;, '#,##0.0'), Num(&lt;SPAN style="font-size: 13.3333px;"&gt;NumberField&lt;/SPAN&gt;, '#,##0')))&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Dec 2015 21:48:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Format-pattern-with-conditional-decimal/m-p/974825#M950349</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2015-12-08T21:48:33Z</dc:date>
    </item>
    <item>
      <title>Re: Format pattern with conditional decimal</title>
      <link>https://community.qlik.com/t5/QlikView/Format-pattern-with-conditional-decimal/m-p/974826#M950350</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sunny, I think you can make it even simpler. The idea is to set the Number format to Expression Default, and use that one whenever the fraction has 2 digits or less. More digits will use a num() with a specific number format string. This translates into something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;=IF(Len(Trim(SubField(NumberField,'.',2))) &amp;gt; 2,Num(NumberField,'#0.00'),NumberField)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It even works in a text box that has no selection for expression default. Try it with a variable instead of NumberField and set the variable to different numbers.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Dec 2015 22:53:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Format-pattern-with-conditional-decimal/m-p/974826#M950350</guid>
      <dc:creator>Peter_Cammaert</dc:creator>
      <dc:date>2015-12-08T22:53:43Z</dc:date>
    </item>
    <item>
      <title>Re: Format pattern with conditional decimal</title>
      <link>https://community.qlik.com/t5/QlikView/Format-pattern-with-conditional-decimal/m-p/974827#M950351</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Make sense &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Dec 2015 23:57:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Format-pattern-with-conditional-decimal/m-p/974827#M950351</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2015-12-08T23:57:08Z</dc:date>
    </item>
  </channel>
</rss>

