<?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: Sum/count if amount within store is under 50 in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Sum-count-if-amount-within-store-is-under-50/m-p/1620426#M734454</link>
    <description>&lt;P&gt;Hi, find attached.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Included the Dimension and using Ifelse statement in expression.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
    <pubDate>Thu, 05 Sep 2019 08:17:16 GMT</pubDate>
    <dc:creator>jerfwork</dc:creator>
    <dc:date>2019-09-05T08:17:16Z</dc:date>
    <item>
      <title>Sum/count if amount within store is under 50</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-count-if-amount-within-store-is-under-50/m-p/1619833#M734447</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am having some issues with getting the right results in some calculations. I think I need to use the aggr function, but I’m doing something wrong.&lt;/P&gt;&lt;P&gt;I want to count and sum data based on some criteria.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the following fields:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Product&lt;/LI&gt;&lt;LI&gt;Amount&lt;/LI&gt;&lt;LI&gt;Store&lt;/LI&gt;&lt;LI&gt;State&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If the status is 0 they always need to be included.&lt;/P&gt;&lt;P&gt;However when it gets more advanced I get issues.&lt;/P&gt;&lt;P&gt;I want to do this:&lt;/P&gt;&lt;P&gt;If status is 1 and the amount per store is under 50 I want to include the rows. If they however are 50 or above, I do not want them to be a part of my result.&lt;/P&gt;&lt;P&gt;I have tried this:&lt;/P&gt;&lt;P&gt;count(distinct if(State =1 and Aggr(sum(AMOUNT),Store)&amp;lt;50,count(AMOUNT),'0'))&lt;/P&gt;&lt;P&gt;… gives me nothing&lt;/P&gt;&lt;P&gt;if(State=1 and Aggr(sum(AMOUNT),Store)&amp;lt;50,count(AMOUNT),'0')&lt;/P&gt;&lt;P&gt;… gives me 0&lt;/P&gt;&lt;P&gt;I have also tries without the State field&lt;/P&gt;&lt;P&gt;count(distinct aggr(if(sum(AMOUNT)&amp;lt;50,store),AMOUNT))&lt;/P&gt;&lt;P&gt;… gives me 0&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Since I can’t share my data, I have created a sample file, that illustrated my issue.&lt;/P&gt;&lt;P&gt;What I would want as result in the sample:&lt;/P&gt;&lt;P&gt;Sum:&lt;/P&gt;&lt;P&gt;Always sum if state 0: 110&lt;/P&gt;&lt;P&gt;Only sum state one, when the amount within each store is under 50. Should be: 45&lt;/P&gt;&lt;P&gt;Total sum wanted: 155&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Count:&lt;/P&gt;&lt;P&gt;Always count if state 0: 4&lt;/P&gt;&lt;P&gt;Only count state one, when the amount within each store is under 50. Should be: 4&lt;/P&gt;&lt;P&gt;Total count wanted: 8&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It seems like I limit my result to only one row pr. store. I guess that makes sense, but I have no idea on how to achieve what I want.&lt;/P&gt;&lt;P&gt;Any guru’s that can help me with this one?&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 02:34:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-count-if-amount-within-store-is-under-50/m-p/1619833#M734447</guid>
      <dc:creator>Zwax</dc:creator>
      <dc:date>2024-11-16T02:34:38Z</dc:date>
    </item>
    <item>
      <title>Re: Sum/count if amount within store is under 50</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-count-if-amount-within-store-is-under-50/m-p/1619839#M734448</link>
      <description>&lt;P&gt;Hello Zwax,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I understand your requirement correctly, just change your dimension to below.&lt;/P&gt;&lt;P&gt;=IF(State=1 AND Amount &amp;lt;= 50,Product)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Find attached.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;Jeff&lt;/P&gt;</description>
      <pubDate>Wed, 04 Sep 2019 06:44:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-count-if-amount-within-store-is-under-50/m-p/1619839#M734448</guid>
      <dc:creator>jerfwork</dc:creator>
      <dc:date>2019-09-04T06:44:38Z</dc:date>
    </item>
    <item>
      <title>Re: Sum/count if amount within store is under 50</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-count-if-amount-within-store-is-under-50/m-p/1619842#M734449</link>
      <description>&lt;P&gt;Just to add on, remember to tick 'Suppress When Value is Null' in order to hide the amount greater than 50.&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 671px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/18395iE172F1C19F07FF54/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Sep 2019 06:47:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-count-if-amount-within-store-is-under-50/m-p/1619842#M734449</guid>
      <dc:creator>jerfwork</dc:creator>
      <dc:date>2019-09-04T06:47:40Z</dc:date>
    </item>
    <item>
      <title>Re: Sum/count if amount within store is under 50</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-count-if-amount-within-store-is-under-50/m-p/1619843#M734450</link>
      <description>&lt;P&gt;Change the dimension to below instead. (Changed from &amp;lt;= 50 to &amp;lt;50)&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;SPAN&gt;=IF(State=1 AND Amount &amp;lt; 50,Product)&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Sep 2019 06:51:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-count-if-amount-within-store-is-under-50/m-p/1619843#M734450</guid>
      <dc:creator>jerfwork</dc:creator>
      <dc:date>2019-09-04T06:51:45Z</dc:date>
    </item>
    <item>
      <title>Re: Sum/count if amount within store is under 50</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-count-if-amount-within-store-is-under-50/m-p/1619856#M734451</link>
      <description>&lt;P&gt;Your sample data and explanation don't look to be in sync. Could you go through your sample app and confirm your expected output?&lt;/P&gt;</description>
      <pubDate>Wed, 04 Sep 2019 07:08:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-count-if-amount-within-store-is-under-50/m-p/1619856#M734451</guid>
      <dc:creator>tresB</dc:creator>
      <dc:date>2019-09-04T07:08:34Z</dc:date>
    </item>
    <item>
      <title>Re: Sum/count if amount within store is under 50</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-count-if-amount-within-store-is-under-50/m-p/1620414#M734452</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Thanks for all your reply's.&amp;nbsp;&lt;/P&gt;&lt;P&gt;It's not giving me the results I want. I probably didn't explain it good enough - sorry&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":slightly_frowning_face:"&gt;🙁&lt;/span&gt;&lt;/P&gt;&lt;P&gt;When I wrote “..and&amp;nbsp;the amount per store is under 50..” I meant the total amount within the store. Or in other words: if the state is 1 and the sum of the amount within the same store is under x.&lt;/P&gt;&lt;P&gt;Example:&lt;/P&gt;&lt;P&gt;Store DX21&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="clipboard_image_0.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/18508i38E05BA85A30B7D6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="clipboard_image_0.png" alt="clipboard_image_0.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;..should not be summed and counted since the sum of the amounts are 55 and therefore over 49.&lt;/P&gt;&lt;P&gt;&amp;nbsp;Store DX25&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="clipboard_image_1.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/18509iAFFE5407C49067DA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="clipboard_image_1.png" alt="clipboard_image_1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;..should be summed and counted since the summed amount is under 50.&lt;/P&gt;&lt;P&gt;Store DX27&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="clipboard_image_2.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/18510iC2B49080403A7338/image-size/medium?v=v2&amp;amp;px=400" role="button" title="clipboard_image_2.png" alt="clipboard_image_2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;.. should be counted and summed by the 2 first rows since they have state 0 (state 0 should always be counted and summed). The third row should however not be counted or summed since it’s above 50.&lt;/P&gt;&lt;P&gt;Actually thinking about it, there is probably even 2 dimensions. Lets say the last number (store DX27) was 45, I would want it to be a part of the result. The total sum of the store is 50 or above, but not in within state 1.&lt;/P&gt;&lt;P&gt;Hope that explains what I’m trying to achieve. Did it make sense?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Sep 2019 08:01:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-count-if-amount-within-store-is-under-50/m-p/1620414#M734452</guid>
      <dc:creator>Zwax</dc:creator>
      <dc:date>2019-09-05T08:01:06Z</dc:date>
    </item>
    <item>
      <title>Re: Sum/count if amount within store is under 50</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-count-if-amount-within-store-is-under-50/m-p/1620423#M734453</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;&lt;P&gt;=Sum({&amp;lt;State={0}&amp;gt; + &amp;lt;State={1},Store={"=Sum({&amp;lt;State={1}&amp;gt;}Amount)&amp;lt;50"}&amp;gt;}Amount)&lt;/P&gt;&lt;P&gt;=Count({&amp;lt;State={0}&amp;gt; + &amp;lt;State={1},Store={"=Sum({&amp;lt;State={1}&amp;gt;}Amount)&amp;lt;50"}&amp;gt;}Amount)&lt;/P&gt;</description>
      <pubDate>Thu, 05 Sep 2019 08:14:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-count-if-amount-within-store-is-under-50/m-p/1620423#M734453</guid>
      <dc:creator>tresB</dc:creator>
      <dc:date>2019-09-05T08:14:30Z</dc:date>
    </item>
    <item>
      <title>Re: Sum/count if amount within store is under 50</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-count-if-amount-within-store-is-under-50/m-p/1620426#M734454</link>
      <description>&lt;P&gt;Hi, find attached.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Included the Dimension and using Ifelse statement in expression.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Sep 2019 08:17:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-count-if-amount-within-store-is-under-50/m-p/1620426#M734454</guid>
      <dc:creator>jerfwork</dc:creator>
      <dc:date>2019-09-05T08:17:16Z</dc:date>
    </item>
    <item>
      <title>Re: Sum/count if amount within store is under 50</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-count-if-amount-within-store-is-under-50/m-p/1620444#M734455</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/22949"&gt;@tresB&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;Try this:&lt;/P&gt;&lt;P&gt;=Sum({&amp;lt;State={0}&amp;gt; + &amp;lt;State={1},Store={"=Sum({&amp;lt;State={1}&amp;gt;}Amount)&amp;lt;50"}&amp;gt;}Amount)&lt;/P&gt;&lt;P&gt;=Count({&amp;lt;State={0}&amp;gt; + &amp;lt;State={1},Store={"=Sum({&amp;lt;State={1}&amp;gt;}Amount)&amp;lt;50"}&amp;gt;}Amount)&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Amazing solution&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":smiling_face_with_smiling_eyes:"&gt;😊&lt;/span&gt;&amp;nbsp;Thank you.&lt;/P&gt;&lt;P&gt;I really need to read up on set analysis...&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Sep 2019 08:37:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-count-if-amount-within-store-is-under-50/m-p/1620444#M734455</guid>
      <dc:creator>Zwax</dc:creator>
      <dc:date>2019-09-05T08:37:33Z</dc:date>
    </item>
  </channel>
</rss>

