<?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: Counts not working properly on field with decimals in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Counts-not-working-properly-on-field-with-decimals/m-p/1692024#M726237</link>
    <description>&lt;P&gt;Brilliant!&amp;nbsp; Thank you much, Sunny and Rubenmarin. I had used Text(), but&amp;nbsp; not on the initial load, and that was why it wasn't working for me. The counts are now working correctly. Much appreciated, both of you.&lt;/P&gt;</description>
    <pubDate>Wed, 08 Apr 2020 14:15:23 GMT</pubDate>
    <dc:creator>JChamber</dc:creator>
    <dc:date>2020-04-08T14:15:23Z</dc:date>
    <item>
      <title>Counts not working properly on field with decimals</title>
      <link>https://community.qlik.com/t5/QlikView/Counts-not-working-properly-on-field-with-decimals/m-p/1692014#M726234</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I have two tables that are associated through a field (called prindiag) which has text characters, and the counts of that&amp;nbsp; field are not working correctly.&amp;nbsp; I believe that the prindiag field is the problem, as its values have a mix of alpha and numeric characters, some with decimals, and leading and trailing zeros. E.g., it has values like 008, 008.0, and 008.00.&amp;nbsp; What I'm seeing, for example, is that if&amp;nbsp; 2 records have values of 008.00 (and no records with either 008 or 008.0), it ends up returning a count of 6 ( 2 records for each for 008, 008.0, and 008.00), which is the incorrect total.&lt;/P&gt;&lt;P&gt;The sample script .qvw file attached and script below illustrate the problem. In that sample data, I would expect a count of 2 for each of the prindiag codes, but the 008, 008.0, and 008.00 each have a count of 6.&amp;nbsp;&lt;/P&gt;&lt;P&gt;It seems as if Qlikview is treating the number as an integer and ignoring the decimals and trailing zeros. Consequently, it's interpreting the value 008 as being identical to 008.0 or 008.00, when they are not.&amp;nbsp; I have tried many solutions (and searched the Forum for others), including converting prindiag to text (using TEXT()), replacing the decimal and creating a new key with concat, but nothing so far has worked.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Any solutions or advice you may have to offer would be greatly appreciated.&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;-John&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;FactSource:&lt;BR /&gt;LOAD * INLINE [&lt;BR /&gt;sys_recid, prindiag&lt;BR /&gt;1, 007.1&lt;BR /&gt;2, 007.1&lt;BR /&gt;3, 007.4&lt;BR /&gt;4, 007.4&lt;BR /&gt;5, 008&lt;BR /&gt;6, 008&lt;BR /&gt;7, 008.0&lt;BR /&gt;8, 008.0&lt;BR /&gt;9, 008.00&lt;BR /&gt;10, 008.00&lt;BR /&gt;];&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Diag_def:&lt;BR /&gt;LOAD * INLINE [&lt;BR /&gt;prindiag, description&lt;BR /&gt;007.1, 007.1 - GIARDIASIS&lt;BR /&gt;007.4, 007.4 - CRYPTOSPORIDIOSIS&lt;BR /&gt;008, 008 - INTESTINAL INFECTIONS DUE TO OTHER ORGANISMS&lt;BR /&gt;008.0, 008.0 - INTESTINAL INFECTION DUE TO ESCHERICHIA COLI&lt;BR /&gt;008.00, 008.00 - INTESTINAL INFECTION DUE TO UNSPECIFIED E COLI&lt;BR /&gt;];&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;FactSource2:&lt;BR /&gt;NoConcatenate LOAD&lt;BR /&gt;sys_recid,&lt;BR /&gt;prindiag&lt;BR /&gt;RESIDENT FactSource;&lt;BR /&gt;DROP TABLE FactSource;&lt;/P&gt;&lt;P&gt;Diag_def2:&lt;BR /&gt;NoConcatenate LOAD&lt;BR /&gt;prindiag,&lt;BR /&gt;description&lt;BR /&gt;RESIDENT Diag_def;&lt;BR /&gt;DROP TABLE Diag_def;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 18:48:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Counts-not-working-properly-on-field-with-decimals/m-p/1692014#M726234</guid>
      <dc:creator>JChamber</dc:creator>
      <dc:date>2024-11-16T18:48:45Z</dc:date>
    </item>
    <item>
      <title>Re: Counts not working properly on field with decimals</title>
      <link>https://community.qlik.com/t5/QlikView/Counts-not-working-properly-on-field-with-decimals/m-p/1692018#M726235</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;FactSource:
LOAD sys_recid,
	 Text(prindiag) as prindiag;
LOAD * INLINE [
    sys_recid, prindiag
    1, 007.1
    2, 007.1
    3, 007.4
    4, 007.4
    5, 008
    6, 008
    7, 008.0
    8, 008.0
    9, 008.00
    10, 008.00
];



Diag_def:
LOAD Text(prindiag) as prindiag,
	 description;
LOAD * INLINE [
    prindiag, description
    007.1, 007.1 - GIARDIASIS
    007.4, 007.4 - CRYPTOSPORIDIOSIS
    008, 008 - INTESTINAL INFECTIONS DUE TO OTHER ORGANISMS
    008.0, 008.0 - INTESTINAL INFECTION DUE TO ESCHERICHIA COLI
    008.00, 008.00 - INTESTINAL INFECTION DUE TO UNSPECIFIED E COLI
];



FactSource2:
NoConcatenate
LOAD sys_recid,
	 prindiag AS prindiag
RESIDENT FactSource;
DROP TABLE FactSource;

Diag_def2:
NoConcatenate
LOAD prindiag AS prindiag,
	 description
RESIDENT Diag_def;
DROP TABLE Diag_def;&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 08 Apr 2020 13:48:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Counts-not-working-properly-on-field-with-decimals/m-p/1692018#M726235</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2020-04-08T13:48:22Z</dc:date>
    </item>
    <item>
      <title>Re: Counts not working properly on field with decimals</title>
      <link>https://community.qlik.com/t5/QlikView/Counts-not-working-properly-on-field-with-decimals/m-p/1692019#M726236</link>
      <description>&lt;P&gt;Hi, I think text() is the solution, check attached document. Text() should be used from the inital load of data.&lt;/P&gt;&lt;P&gt;Edit: Hi Sunny, I forgot to reload the tab before answering.&lt;span class="lia-unicode-emoji" title=":grinning_face_with_sweat:"&gt;😅&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Apr 2020 13:55:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Counts-not-working-properly-on-field-with-decimals/m-p/1692019#M726236</guid>
      <dc:creator>rubenmarin</dc:creator>
      <dc:date>2020-04-08T13:55:53Z</dc:date>
    </item>
    <item>
      <title>Re: Counts not working properly on field with decimals</title>
      <link>https://community.qlik.com/t5/QlikView/Counts-not-working-properly-on-field-with-decimals/m-p/1692024#M726237</link>
      <description>&lt;P&gt;Brilliant!&amp;nbsp; Thank you much, Sunny and Rubenmarin. I had used Text(), but&amp;nbsp; not on the initial load, and that was why it wasn't working for me. The counts are now working correctly. Much appreciated, both of you.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Apr 2020 14:15:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Counts-not-working-properly-on-field-with-decimals/m-p/1692024#M726237</guid>
      <dc:creator>JChamber</dc:creator>
      <dc:date>2020-04-08T14:15:23Z</dc:date>
    </item>
  </channel>
</rss>

