<?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: Where is the error in this formula? in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Where-is-the-error-in-this-formula/m-p/2497836#M102791</link>
    <description>&lt;P&gt;Excuse me, is it possible to count the total of A, B, C, and place it within a KPI?, that is, have a kpi of the total of A=20, another of B=15, etc. If it is possible, could you tell me how?&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;</description>
    <pubDate>Fri, 13 Dec 2024 08:02:26 GMT</pubDate>
    <dc:creator>MariaCruz1991</dc:creator>
    <dc:date>2024-12-13T08:02:26Z</dc:date>
    <item>
      <title>Where is the error in this formula?</title>
      <link>https://community.qlik.com/t5/App-Development/Where-is-the-error-in-this-formula/m-p/2420528#M95635</link>
      <description>&lt;P&gt;Hello... so I want a formula that classifies a lists of stores in A,B,C. The first 10% of the stores should be A, the next 20% should be B and then C&lt;/P&gt;
&lt;P&gt;I created a row in my table, which enumarates the stores, the formula I used in that row is NoRow().&lt;/P&gt;
&lt;P&gt;Here is the formula:&lt;/P&gt;
&lt;P&gt;if(RowNo()/Count(RowNo()) &amp;lt;= 0.1, 'A',&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(RowNo()/Count(RowNo()) &amp;lt;= 0.3, 'B',&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'C'&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;/P&gt;
&lt;P&gt;)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;it is not working out for me... what could i be doing wrng?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;thanks&lt;/P&gt;</description>
      <pubDate>Fri, 15 Nov 2024 21:03:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Where-is-the-error-in-this-formula/m-p/2420528#M95635</guid>
      <dc:creator>Nemo1</dc:creator>
      <dc:date>2024-11-15T21:03:39Z</dc:date>
    </item>
    <item>
      <title>Re: Where is the error in this formula?</title>
      <link>https://community.qlik.com/t5/App-Development/Where-is-the-error-in-this-formula/m-p/2420555#M95638</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/285717"&gt;@Nemo1&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What order do you want the stores in, is it based on sales, location or alphabetically?&lt;/P&gt;
&lt;P&gt;Once a store has been classified, should it change that classification based on the current selections?&lt;/P&gt;
&lt;P&gt;If you were to do it taking current selections into account, based on Sales, the expression would be something like:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;if(rank(TOTAL sum(Sales),2,1)/count(TOTAL DISTINCT StoreNo) &amp;lt;= 0.1, 'A', &lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;if(rank(TOTAL sum(Sales),2,1)/count(TOTAL DISTINCT StoreNo) &amp;lt;= 0.3, 'B', 'C'))&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="stevedark_0-1708330808270.png" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/160136iD557D0B2891ADA66/image-size/large?v=v2&amp;amp;px=999" role="button" title="stevedark_0-1708330808270.png" alt="stevedark_0-1708330808270.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Test data for this created with this load script:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;SalesData:&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;LOAD&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;num(RowNo(), '000000') as StoreNo,&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;floor(Rand()*100000) as Sales&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;AUTOGENERATE(20000);&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;I've selected just the last ten stores, so you can see multiple categories in the screengrab.&lt;/P&gt;
&lt;P&gt;If you wanted to catagorise the stores so they are permanently in their category regardless of selections (so you could select all category A, for example) then you would need to do similar calculations in the load script, using a GROUP BY statement and a RESIDENT load.&lt;/P&gt;
&lt;P&gt;Let me know if that is the case.&lt;/P&gt;
&lt;P&gt;Hope that helps.&lt;/P&gt;
&lt;P&gt;Steve&lt;/P&gt;</description>
      <pubDate>Mon, 19 Feb 2024 08:24:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Where-is-the-error-in-this-formula/m-p/2420555#M95638</guid>
      <dc:creator>stevedark</dc:creator>
      <dc:date>2024-02-19T08:24:19Z</dc:date>
    </item>
    <item>
      <title>Re: Where is the error in this formula?</title>
      <link>https://community.qlik.com/t5/App-Development/Where-is-the-error-in-this-formula/m-p/2420716#M95655</link>
      <description>&lt;P&gt;The stores are ordered according to their sales.&lt;/P&gt;
&lt;P&gt;Yes, once the classification should change according to selections/filters.&lt;/P&gt;
&lt;P&gt;I tried the formula you wrote, but it classified all my stores as "C".. idk why?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;thanks&lt;/P&gt;</description>
      <pubDate>Mon, 19 Feb 2024 12:09:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Where-is-the-error-in-this-formula/m-p/2420716#M95655</guid>
      <dc:creator>Nemo1</dc:creator>
      <dc:date>2024-02-19T12:09:48Z</dc:date>
    </item>
    <item>
      <title>Re: Where is the error in this formula?</title>
      <link>https://community.qlik.com/t5/App-Development/Where-is-the-error-in-this-formula/m-p/2420887#M95668</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/285717"&gt;@Nemo1&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You will need to debug by creating a table that has all the constituent parts of the expression.&lt;/P&gt;
&lt;P&gt;So, have the following columms:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt; StoreNo&lt;/STRONG&gt; as a dimension&lt;BR /&gt;&lt;STRONG&gt;sum(Sales)&lt;/STRONG&gt;&amp;nbsp; (or whatever your sales calc is)&lt;BR /&gt;&lt;STRONG&gt;rank(TOTAL sum(Sales),2,1)&amp;nbsp; &amp;nbsp;&lt;/STRONG&gt;(should be numbers 1 to 200)&lt;STRONG&gt;&lt;BR /&gt;count(TOTAL DISTINCT StoreNo)&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/STRONG&gt;(should be the same on all rows)&lt;BR /&gt;&lt;STRONG&gt;rank(TOTAL sum(Sales),2,1)/count(TOTAL DISTINCT StoreNo)&amp;nbsp; &lt;/STRONG&gt;(as a %)&lt;/P&gt;
&lt;P&gt;Finally, have the actual A, B, C expression.&lt;/P&gt;
&lt;P&gt;Hopefully by seeing all the values broken out like that you should be able to see what is going wrong.&lt;/P&gt;
&lt;P&gt;Perhaps you could share a screenshot of that table, if you can't figure out what needs changing - with any sensitive details obfuscated of course.&lt;/P&gt;
&lt;P&gt;Steve&lt;/P&gt;</description>
      <pubDate>Mon, 19 Feb 2024 20:07:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Where-is-the-error-in-this-formula/m-p/2420887#M95668</guid>
      <dc:creator>stevedark</dc:creator>
      <dc:date>2024-02-19T20:07:36Z</dc:date>
    </item>
    <item>
      <title>Re: Where is the error in this formula?</title>
      <link>https://community.qlik.com/t5/App-Development/Where-is-the-error-in-this-formula/m-p/2497836#M102791</link>
      <description>&lt;P&gt;Excuse me, is it possible to count the total of A, B, C, and place it within a KPI?, that is, have a kpi of the total of A=20, another of B=15, etc. If it is possible, could you tell me how?&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 13 Dec 2024 08:02:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Where-is-the-error-in-this-formula/m-p/2497836#M102791</guid>
      <dc:creator>MariaCruz1991</dc:creator>
      <dc:date>2024-12-13T08:02:26Z</dc:date>
    </item>
    <item>
      <title>Re: Where is the error in this formula?</title>
      <link>https://community.qlik.com/t5/App-Development/Where-is-the-error-in-this-formula/m-p/2497842#M102793</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/323185"&gt;@MariaCruz1991&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If I understand correctly, you probably want a Text and Image object and a measure which concatenates the parts:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;='A=' &amp;amp; sum(if(rank(TOTAL sum(Sales),2,1)/count(TOTAL DISTINCT StoreNo) &amp;lt;= 0.1, Sales, 0) &amp;amp;&lt;BR /&gt;' B= ' &amp;amp; sum(if(rank(TOTAL sum(Sales),2,1)/count(TOTAL DISTINCT StoreNo) &amp;gt; 0.1 and if(rank(TOTAL sum(Sales),2,1)/count(TOTAL DISTINCT StoreNo) &amp;lt;= 0.3, Sales, 0) &amp;amp;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;'C=' &amp;amp; sum(if(rank(TOTAL sum(Sales),2,1)/count(TOTAL DISTINCT StoreNo) &amp;gt; 0.3, Sales, 0)&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;You might find that having a new table object and having three measures and then changing the font size to make it more like a KPI than a table might work better from a look and feel perspective.&lt;/P&gt;
&lt;P&gt;If you are building a string, as above, you should probably also add&amp;nbsp;&lt;STRONG&gt;num&lt;/STRONG&gt; functions to tidy the figures.&lt;/P&gt;
&lt;P&gt;Hope that makes sense.&lt;/P&gt;
&lt;P&gt;Steve&lt;/P&gt;</description>
      <pubDate>Fri, 13 Dec 2024 08:17:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Where-is-the-error-in-this-formula/m-p/2497842#M102793</guid>
      <dc:creator>stevedark</dc:creator>
      <dc:date>2024-12-13T08:17:43Z</dc:date>
    </item>
  </channel>
</rss>

