<?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: Percentile calculation based on 2 columns: Value &amp;amp; Repetitions in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Percentile-calculation-based-on-2-columns-Value-amp-Repetitions/m-p/2514196#M105455</link>
    <description>&lt;P&gt;Thanks for trying to help me. I appreaciate your approach! &lt;span class="lia-unicode-emoji" title=":folded_hands:"&gt;🙏&lt;/span&gt;&lt;span class="lia-unicode-emoji" title=":folded_hands:"&gt;🙏&lt;/span&gt; However, it's based on script. I need something based on expressions.&lt;/P&gt;
&lt;P&gt;The example I sent was a very simple one. Reality is that I have tens of thousands of items, with values from 1 to 1000 (incremental steps of 1 unit). To make it simple, the loading table structure looks like:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="fsomos_0-1744612007888.png" style="width: 525px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/179592iE4001E2BD5E80A90/image-dimensions/525x126?v=v2" width="525" height="126" role="button" title="fsomos_0-1744612007888.png" alt="fsomos_0-1744612007888.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Therefore, Item 1: 10, 30, 30, 30, 50, 50. Percentile 80%: 50&lt;/P&gt;
&lt;P&gt;Item 2: 20, 20, 20, 20, 60, 60, 60, 60, 60, 60, 90. Percentile 80%: 60&lt;/P&gt;
&lt;P&gt;Item 3: 20, 20, 40, 40, 40, 70, 100. Percentile 80%: 64&lt;/P&gt;
&lt;P&gt;In the Script, I load the above table using "crosstable". Later I present a table where "Item" is the Dimension) and I need one column with the percentile for each item.&lt;/P&gt;
&lt;P&gt;Doing it at script level would be unmanageable with so many thousands and thousands of resident tables (one resident tabla per item).&lt;/P&gt;
&lt;P&gt;Any suggestion?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 14 Apr 2025 06:40:19 GMT</pubDate>
    <dc:creator>fsomos</dc:creator>
    <dc:date>2025-04-14T06:40:19Z</dc:date>
    <item>
      <title>Percentile calculation based on 2 columns: Value &amp; Repetitions</title>
      <link>https://community.qlik.com/t5/App-Development/Percentile-calculation-based-on-2-columns-Value-amp-Repetitions/m-p/2514134#M105442</link>
      <description>&lt;P&gt;Hello. I load a table with 2 columns: Value and Repetitions:&lt;/P&gt;
&lt;TABLE style="border-collapse: collapse; width: 120pt;" border="0" width="160" cellspacing="0" cellpadding="0"&gt;&lt;COLGROUP&gt;&lt;COL style="width: 60pt;" span="2" width="80" /&gt; &lt;/COLGROUP&gt;
&lt;TBODY&gt;
&lt;TR style="height: 14.25pt;"&gt;
&lt;TD width="80" height="19" class="xl65" style="height: 14.25pt; width: 60pt;"&gt;Value&lt;/TD&gt;
&lt;TD width="80" class="xl65" style="border-left: none; width: 60pt;"&gt;Repetitions&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.25pt;"&gt;
&lt;TD height="19" class="xl66" style="height: 14.25pt; border-top: none;"&gt;2&lt;/TD&gt;
&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;4&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.25pt;"&gt;
&lt;TD height="19" class="xl66" style="height: 14.25pt; border-top: none;"&gt;3&lt;/TD&gt;
&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;3&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.25pt;"&gt;
&lt;TD height="19" class="xl66" style="height: 14.25pt; border-top: none;"&gt;4&lt;/TD&gt;
&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.25pt;"&gt;
&lt;TD height="19" class="xl66" style="height: 14.25pt; border-top: none;"&gt;5&lt;/TD&gt;
&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.25pt;"&gt;
&lt;TD height="19" class="xl66" style="height: 14.25pt; border-top: none;"&gt;6&lt;/TD&gt;
&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.25pt;"&gt;
&lt;TD height="19" class="xl66" style="height: 14.25pt; border-top: none;"&gt;7&lt;/TD&gt;
&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.25pt;"&gt;
&lt;TD height="19" class="xl66" style="height: 14.25pt; border-top: none;"&gt;8&lt;/TD&gt;
&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Therefore, value 2 is repeated 4 times, and so on... The above table represents this list of numbers:&lt;/P&gt;
&lt;TABLE width="229"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="229"&gt;2,2,2,2,3,3,3,4,4,5,6,7,8,&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;I want to calculate the percentile 80% for that list of values. I know, the result is: 5.6&lt;/P&gt;
&lt;P&gt;How can, I get the result in a text box?. I tried:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="fsomos_0-1744533328035.png" style="width: 236px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/179584i2C4489D2FCACF0BE/image-dimensions/236x101?v=v2" width="236" height="101" role="button" title="fsomos_0-1744533328035.png" alt="fsomos_0-1744533328035.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;But it's not working since I get:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="fsomos_1-1744533436773.png" style="width: 275px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/179585i9A453AB45BD12746/image-dimensions/275x203?v=v2" width="275" height="203" role="button" title="fsomos_1-1744533436773.png" alt="fsomos_1-1744533436773.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;And now 2222 it's considered as a full number and so on... Therefore, the 80% percentile is: 275.2 (Completely wrong!)&lt;/P&gt;
&lt;P&gt;Please, any idea? It looks such a simple problem but... So difficult!!!! Please, help!&lt;/P&gt;
&lt;P&gt;Thanks in advance!! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 13 Apr 2025 08:42:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Percentile-calculation-based-on-2-columns-Value-amp-Repetitions/m-p/2514134#M105442</guid>
      <dc:creator>fsomos</dc:creator>
      <dc:date>2025-04-13T08:42:55Z</dc:date>
    </item>
    <item>
      <title>Re: Percentile calculation based on 2 columns: Value &amp; Repetitions</title>
      <link>https://community.qlik.com/t5/App-Development/Percentile-calculation-based-on-2-columns-Value-amp-Repetitions/m-p/2514140#M105443</link>
      <description>&lt;P&gt;Hey, is this what you're looking for?&lt;/P&gt;
&lt;P&gt;Load script&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;TempTable:
LOAD * INLINE [
Value, Repetitions
2, 4
3, 3
4, 2
5, 1
6, 1
7, 1
8, 1
];

// Generate individual rows using IterNo()
ExpandedData:
LOAD
Value
RESIDENT TempTable
WHILE IterNo() &amp;lt;= Repetitions;&lt;/LI-CODE&gt;
&lt;P class="" data-start="669" data-end="725"&gt;This will expand each row based on its repetition count.&lt;/P&gt;
&lt;P class="" data-start="669" data-end="725"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="" data-start="752" data-end="805"&gt;Then in your app (KPI, chart, etc), you can just use:&lt;/P&gt;
&lt;P class="" data-start="752" data-end="805"&gt;Fractile(Value, 0.8)&lt;/P&gt;
&lt;P class="" data-start="752" data-end="805"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="" data-start="931" data-end="965"&gt;Let me know if that works for you!&lt;/P&gt;</description>
      <pubDate>Sun, 13 Apr 2025 12:58:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Percentile-calculation-based-on-2-columns-Value-amp-Repetitions/m-p/2514140#M105443</guid>
      <dc:creator>Qlikard</dc:creator>
      <dc:date>2025-04-13T12:58:41Z</dc:date>
    </item>
    <item>
      <title>Re: Percentile calculation based on 2 columns: Value &amp; Repetitions</title>
      <link>https://community.qlik.com/t5/App-Development/Percentile-calculation-based-on-2-columns-Value-amp-Repetitions/m-p/2514196#M105455</link>
      <description>&lt;P&gt;Thanks for trying to help me. I appreaciate your approach! &lt;span class="lia-unicode-emoji" title=":folded_hands:"&gt;🙏&lt;/span&gt;&lt;span class="lia-unicode-emoji" title=":folded_hands:"&gt;🙏&lt;/span&gt; However, it's based on script. I need something based on expressions.&lt;/P&gt;
&lt;P&gt;The example I sent was a very simple one. Reality is that I have tens of thousands of items, with values from 1 to 1000 (incremental steps of 1 unit). To make it simple, the loading table structure looks like:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="fsomos_0-1744612007888.png" style="width: 525px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/179592iE4001E2BD5E80A90/image-dimensions/525x126?v=v2" width="525" height="126" role="button" title="fsomos_0-1744612007888.png" alt="fsomos_0-1744612007888.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Therefore, Item 1: 10, 30, 30, 30, 50, 50. Percentile 80%: 50&lt;/P&gt;
&lt;P&gt;Item 2: 20, 20, 20, 20, 60, 60, 60, 60, 60, 60, 90. Percentile 80%: 60&lt;/P&gt;
&lt;P&gt;Item 3: 20, 20, 40, 40, 40, 70, 100. Percentile 80%: 64&lt;/P&gt;
&lt;P&gt;In the Script, I load the above table using "crosstable". Later I present a table where "Item" is the Dimension) and I need one column with the percentile for each item.&lt;/P&gt;
&lt;P&gt;Doing it at script level would be unmanageable with so many thousands and thousands of resident tables (one resident tabla per item).&lt;/P&gt;
&lt;P&gt;Any suggestion?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Apr 2025 06:40:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Percentile-calculation-based-on-2-columns-Value-amp-Repetitions/m-p/2514196#M105455</guid>
      <dc:creator>fsomos</dc:creator>
      <dc:date>2025-04-14T06:40:19Z</dc:date>
    </item>
  </channel>
</rss>

