<?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 if greater than in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Sum-if-greater-than/m-p/128314#M19395</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;please attach a sample table.&lt;/P&gt;&lt;P&gt;I'm pretty sure that you can do it with set analysis... try this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;create a variable like vDATEJOUR with a variable box.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;sum({&amp;lt; CCRI_LOT = {'$DLC'} , VALD_LOTcrit= {"&amp;lt;=$(vDATEJOUR)"}&amp;gt;} &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt; MTPXREVSTAT_STD_S_SIT)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 14 Sep 2018 10:45:17 GMT</pubDate>
    <dc:creator>captain89</dc:creator>
    <dc:date>2018-09-14T10:45:17Z</dc:date>
    <item>
      <title>Sum if greater than</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-if-greater-than/m-p/128313#M19394</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello, &lt;/P&gt;&lt;P&gt;I am stuck on a sum problem and I think I need to use AGGR but I'm not very adept at implementing this function yet.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So I have a table : SITUATIONS with the stock situations by date.&amp;nbsp; In this table we have the quantity, value, and state of the Batch number for each item in stock.&amp;nbsp; I have another table CRITERE which has the criteria for each batch number.&amp;nbsp; The criteria are expiration date, sell-by date and use-by date.&amp;nbsp; Each criteria has a &lt;SPAN style="font-size: 13.3333px;"&gt;VALD_LOTcrit&lt;/SPAN&gt; for the date that criteria goes into affect.&amp;nbsp; For exemple the criteria DLC will go into affect the 31/8/2018 for a batch.&amp;nbsp; Each batch does not have an entry in the criteria table for the three criteria we are checking.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to build a table that will calculate the provision based on the state of the batch and based on the criteria.&amp;nbsp; &lt;/P&gt;&lt;P&gt;To do this step by step, I have added the batch as the dimension, and my expressions are &lt;/P&gt;&lt;P&gt;1. the value * the percentage based on the state, &lt;/P&gt;&lt;P&gt;2. the value&amp;nbsp; if there is a DLC criteria and the &lt;SPAN style="font-size: 13.3333px;"&gt;VALD_LOTcrit&lt;/SPAN&gt; is &amp;lt;= the date selected, &lt;/P&gt;&lt;P&gt;3. the value if there is a DLUO criteria and the &lt;SPAN style="font-size: 13.3333px;"&gt;VALD_LOTcrit&lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333px;"&gt; is &amp;lt;= the date selected&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;4. &lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;the value if there is a DLS criteria and the &lt;SPAN style="font-size: 13.3333px;"&gt;VALD_LOTcrit&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333px;"&gt; is &amp;lt;= the date selected&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Expression 1 is OK.&amp;nbsp; For the others I seem to have hit a wall.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have tried this : &lt;/P&gt;&lt;P&gt;if ( CCRI_LOT = '$DLC' and VALD_LOTcrit &amp;lt;= DATEJOUR, sum( MTPXREVSTAT_STD_S_SIT), 0)&lt;/P&gt;&lt;P&gt;but it returns 0.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And I have tried this : &lt;/P&gt;&lt;P&gt;sum( aggr( if (CCRI_LOT = '$DLC' and VALD_LOTcrit &amp;lt;= [DATEJOUR] , MTPXREVSTAT_STD_S_SIT), LOT_SIT))&lt;/P&gt;&lt;P&gt;but it also returns 0.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does anyone have any ideas ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Sep 2018 10:30:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-if-greater-than/m-p/128313#M19394</guid>
      <dc:creator>leenlart</dc:creator>
      <dc:date>2018-09-14T10:30:37Z</dc:date>
    </item>
    <item>
      <title>Re: Sum if greater than</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-if-greater-than/m-p/128314#M19395</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;please attach a sample table.&lt;/P&gt;&lt;P&gt;I'm pretty sure that you can do it with set analysis... try this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;create a variable like vDATEJOUR with a variable box.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;sum({&amp;lt; CCRI_LOT = {'$DLC'} , VALD_LOTcrit= {"&amp;lt;=$(vDATEJOUR)"}&amp;gt;} &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt; MTPXREVSTAT_STD_S_SIT)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Sep 2018 10:45:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-if-greater-than/m-p/128314#M19395</guid>
      <dc:creator>captain89</dc:creator>
      <dc:date>2018-09-14T10:45:17Z</dc:date>
    </item>
    <item>
      <title>Re: Sum if greater than</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-if-greater-than/m-p/128315#M19396</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I totally didn't believe that it would work, &lt;SPAN style="font-size: 13.3333px;"&gt;but it does!!&amp;nbsp; T&lt;/SPAN&gt;hanks!!&amp;nbsp; &lt;/P&gt;&lt;P&gt;I was using DATEJOUR which is the field with the end date of a month in my calendar.&amp;nbsp; I don't understand why this didn't work.&amp;nbsp; &lt;/P&gt;&lt;P&gt;So I created the variable vDATEJOUR, and I set it&amp;nbsp; = DATEJOUR.&amp;nbsp; &lt;/P&gt;&lt;P&gt;If you can explain why a variable works better, I would really appreciate it.&amp;nbsp; It might help me to avoid hitting more walls in the future, as my nose is getting sore.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/wink.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Sep 2018 10:57:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-if-greater-than/m-p/128315#M19396</guid>
      <dc:creator>leenlart</dc:creator>
      <dc:date>2018-09-14T10:57:10Z</dc:date>
    </item>
    <item>
      <title>Re: Sum if greater than</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-if-greater-than/m-p/128316#M19397</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can't compare more than 1 value (VALD_LOTcrit) with another field with more than 1 value (&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;DATEJOUR)&lt;/SPAN&gt;.&lt;/P&gt;&lt;P&gt;If you use an expression that let you get one value (for example max(&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;DATEJOUR)) you can compare one field with another but i think that a variable is a better way to do that for you in this case.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;try without the variable&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;sum({&amp;lt; CCRI_LOT = {'$DLC'} , VALD_LOTcrit= {"&amp;lt;=$(=max(&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;DATEJOUR&lt;/SPAN&gt;))"}&amp;gt;} MTPXREVSTAT_STD_S_SIT)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;maybe it runs anyway&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sorry for my english I'm italian. I must improve it.&lt;/P&gt;&lt;P&gt;Thanks for the mark!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Sep 2018 11:52:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-if-greater-than/m-p/128316#M19397</guid>
      <dc:creator>captain89</dc:creator>
      <dc:date>2018-09-14T11:52:27Z</dc:date>
    </item>
  </channel>
</rss>

