<?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 aggr with conditions in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Sum-aggr-with-conditions/m-p/120429#M763380</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It's good that you have provided so much information, but I think it might be easy to understand your expression without seeing them in action... would you be able to share a sample to see what you have.... Also, is this calculating the duration?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Capture.PNG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/208700_Capture.PNG" style="height: 167px; width: 620px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 24 Jul 2018 15:10:08 GMT</pubDate>
    <dc:creator>sunny_talwar</dc:creator>
    <dc:date>2018-07-24T15:10:08Z</dc:date>
    <item>
      <title>Sum aggr with conditions</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-aggr-with-conditions/m-p/120428#M763379</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I’m new in the community and I'm seeking your help because I can't find a&amp;nbsp; solution (also performant) to my problem. &lt;/P&gt;&lt;P&gt;I'm trying to build an evolution line chart (dimension Month), that sums the stock quantity of each SKU, only if certain conditions are true. &lt;/P&gt;&lt;P&gt;I tried several ways to force the "loop" (using aggr) by SKU in order to collect and classify each quantity but it seems that when I select a group of materials the indicator does not work.&lt;/P&gt;&lt;P&gt;The conditions are the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;OL style="list-style-type: decimal;"&gt;&lt;LI&gt;1. If SKU stock Duration &amp;lt; 12 months, then SKU qty is "Good"&lt;/LI&gt;&lt;LI&gt;2. If SKU stock Duration &amp;gt; 12 Months, then SKU qty is "Bad".&lt;/LI&gt;&lt;LI&gt;3. If SKU stock Duration &amp;gt; 12 Months, but has reception movements,&amp;nbsp; then SKU qty is "Good".&lt;/LI&gt;&lt;LI&gt;Else Dead.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The behavior should be like this:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Requirement - Qlik - Aggr with Condition.bmp" class="jive-image image-1" src="/legacyfs/online/208655_Requirement - Qlik - Aggr with Condition.bmp" style="height: 120px; width: 620px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;1st approach not performant and only Works for one single SKU:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;IF&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;((&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;sum&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;({$&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;Time.Quarter&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;=,&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;Time.Year&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;=,&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;Time.Month&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;=,&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;Time.YearMonth&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;=,&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;Time.Date&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;=&amp;gt;}&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;aggr&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;sum&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;({$&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;Doc.Source&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;={'Pos'},&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;Time.YearMonth&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;={&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;"$(=MonthName(Max(%Time.Evo.YearMonth)))"&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;}&amp;gt;}&lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM style="color: gray; font-size: 9.0pt; font-family: 'Courier New';"&gt;#StockQty&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;%Time.Evo.Month&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;Material.Code&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;))&lt;BR /&gt; /&lt;BR /&gt; (&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;sum&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;({$&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;Time.Quarter&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;=,&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;Time.Year&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;=,&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;Time.Month&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;=,&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;Time.YearMonth&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;=,&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;Time.Date&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;=&amp;gt;}&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;aggr&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;(&lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;fabs&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;sum&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;({$&amp;lt;Doc.Source={'MovR6'},MovementAggr={'Consumptions'},%Time.YearMonth={&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;"$(=MonthName(Max(%Time.Evo.YearMonth)))"&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;}&amp;gt;}&lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM style="color: gray; font-size: 9.0pt; font-family: 'Courier New';"&gt;MovQty&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;/6), %Time.Evo.Month, Material.Code))))&lt;BR /&gt; &amp;lt;=12&lt;BR /&gt; OR&lt;BR /&gt; &lt;BR /&gt; (sum({$&amp;lt;Time.Quarter=,Time.Year=,Time.Month=,Time.YearMonth=,Time.Date=&amp;gt;}aggr(&lt;BR /&gt; (sum({$&amp;lt;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM style="color: gray; font-size: 9.0pt; font-family: 'Courier New';"&gt;$(rMovementsReset)&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;,Doc.Source={'Mov'},&lt;BR /&gt; MovementAggr={'Receptions'},%Time.Type={'R12'},Time.Month=, Time.Year=, %Time.Key={&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;"&amp;lt;$(=floor(AddMonths(MonthEnd(Max(%Time.Evo.YearMonth),0)))) &amp;gt;=$(=floor(AddMonths(MonthStart(%Time.Evo.YearMonth),-6)))"&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;}&amp;gt;}&lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM style="color: gray; font-size: 9.0pt; font-family: 'Courier New';"&gt;#MovQty)&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;)), %Time.Evo.Month, Material.Code)))&lt;BR /&gt; &amp;gt;0&lt;BR /&gt; ,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;&lt;BR /&gt; (sum({$&amp;lt;Time.Quarter=,Time.Year=,Time.Month=,Time.YearMonth=,Time.Date=&amp;gt;}&lt;BR /&gt; &lt;BR /&gt; aggr( &lt;BR /&gt; sum({&amp;lt; &lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM style="color: gray; font-size: 9.0pt; font-family: 'Courier New';"&gt;$(rPositionsReset)&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;,Doc.Source={'Pos'},Time.Date=,&lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM style="color: gray; font-size: 9.0pt; font-family: 'Courier New';"&gt;$(tSetStockCP)&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;,Pos.EndMonth.Flag={'X'},%Time.Type={'R12'}&amp;gt;} &lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM style="color: gray; font-size: 9.0pt; font-family: 'Courier New';"&gt;#Stockqty&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;),%Time.Evo.Month, Material.Code)))&lt;BR /&gt; , 0)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN lang="EN-US" style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;2nd approach only works for one single SKU&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;Sum(&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;({$&amp;lt;Time.Quarter=,Time.Year=,Time.Month=,Time.YearMonth=,Time.Date=&amp;gt;}&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;aggr(&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;sum&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;({&amp;lt;Doc.Source={'Pos'}, &lt;STRONG&gt;Material.Code={&lt;/STRONG&gt;'=((sum({$&amp;lt;Time.Quarter=,Time.Year=,Time.Month=,Time.YearMonth=,Time.Date=&amp;gt;}aggr(sum({$&amp;lt;Doc.Source={"Pos"},&lt;BR /&gt; Time.YearMonth={"$(=MonthName(Max(%Time.Evo.YearMonth)))"}&amp;gt;}#Qty_Base_Unit), %Time.Evo.Month, Material.Code))&lt;BR /&gt; /&lt;BR /&gt; (sum({$&amp;lt;Time.Quarter=,Time.Year=,Time.Month=,Time.YearMonth=,Time.Date=&amp;gt;}aggr(fabs(sum({$&amp;lt; Doc.Source={"MovR6"},MovementAggr={"Consumptions"}, Time.YearMonth={"$(=MonthName(Max(%Time.Evo.YearMonth)))"}&amp;gt;}#Qty_Base_Unit)/6), %Time.Evo.Month,.Code)))))&amp;gt;12'},&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;&lt;BR /&gt; &lt;BR /&gt; &lt;STRONG&gt;Material.Code={&lt;/STRONG&gt;'(sum({$&amp;lt;Time.Quarter=,Time.Year=,Time.Month=,Time.YearMonth=,Time.Date=&amp;gt;}aggr(&lt;BR /&gt; (sum({$&amp;lt;Doc.Source={"Mov"},&lt;BR /&gt; MovementAggr={"Receptions"},Time.Month=, Time.Year=, %Time.Key={"&amp;lt;$(=floor(AddMonths(MonthEnd(Max(%Time.Evo.YearMonth),0)))) &amp;gt;=$(=floor(AddMonths(MonthStart(%Time.Evo.YearMonth),-6)))"}&amp;gt;}#MovQty_Base_Unit)), %Time.Evo.Month, Material.Code)))&lt;BR /&gt; =0'}&amp;gt;}&lt;BR /&gt; &lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM style="color: gray; font-size: 9.0pt; font-family: 'Courier New';"&gt;$(='#Qty_'&amp;amp;%Units)&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;), %Time.Evo.Month, Material.Code ))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;Sorry for my huge post but I'm trying to explain to you my problem as best as I can &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt; &lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;Best Regards, &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;Luciana&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Nov 2020 16:16:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-aggr-with-conditions/m-p/120428#M763379</guid>
      <dc:creator>luciana_lima</dc:creator>
      <dc:date>2020-11-25T16:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: Sum aggr with conditions</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-aggr-with-conditions/m-p/120429#M763380</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It's good that you have provided so much information, but I think it might be easy to understand your expression without seeing them in action... would you be able to share a sample to see what you have.... Also, is this calculating the duration?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Capture.PNG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/208700_Capture.PNG" style="height: 167px; width: 620px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Jul 2018 15:10:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-aggr-with-conditions/m-p/120429#M763380</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2018-07-24T15:10:08Z</dc:date>
    </item>
    <item>
      <title>Re: Sum aggr with conditions</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-aggr-with-conditions/m-p/120430#M763381</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Sunny,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your quick feedback!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes, it is the Duration calculation (Current Stock \ 6month avg Consumptions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please check the qvw attached with my test scenario so you can see my problem. It's a little bit complex ("over-complex" for sure!)&amp;nbsp; due to my data model but I think you can get the idea. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, I have in both objects the set analysis using the "If condition" and another try with Aggr and "complex" modifiers.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Jul 2018 11:12:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-aggr-with-conditions/m-p/120430#M763381</guid>
      <dc:creator>luciana_lima</dc:creator>
      <dc:date>2018-07-25T11:12:06Z</dc:date>
    </item>
    <item>
      <title>Re: Sum aggr with conditions</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-aggr-with-conditions/m-p/120431#M763382</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;STRONG style="color: #ff0000;"&gt;Sum({$&amp;lt;Time.Quarter=,Time.Year=,Time.Month=,Time.YearMonth=,Time.Date=&amp;gt;}Aggr(&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt; IF(&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt;(sum({$&amp;lt;Time.Quarter=,Time.Year=,Time.Month=,Time.YearMonth=,Time.Date=&amp;gt;}aggr(sum({$&amp;lt;Doc.Source={'Pos'},&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt; Pos.EndMonth.Flag={'X'},%Time.Type={'R12'},Time.YearMonth={"$(=MonthName(Max(%Time.Evo.YearMonth)))"},%Units={"$(=only(%Units))"}, MaterialGroupAggr={'Paper'}&amp;gt;}$(='#Qty_'&amp;amp;%Units)), %Time.Evo.Month,Material.Code))&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt;/&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt;(sum({$&amp;lt;Time.Quarter=,Time.Year=,Time.Month=,Time.YearMonth=,Time.Date=&amp;gt;}aggr(&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt; fabs(sum({$&amp;lt; Doc.Source={'MovR6'},MovementAggr={'Consumptions'},%Time.Type={'R12'},Time.YearMonth={"$(=MonthName(Max(%Time.Evo.YearMonth)))"},%Units={"$(=only(%Units))"}, MaterialGroupAggr={'Paper'}&amp;gt;}$(='#Qty_'&amp;amp;%Units))/6), %Time.Evo.Month, Material.Code))))&amp;gt;12&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt;//AND&amp;nbsp; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt;//num((sum({$&amp;lt;Time.Quarter=,Time.Year=,Time.Month=,Time.YearMonth=,Time.Date=&amp;gt;}aggr(&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt;//(sum({$&amp;lt;$(rMovementsReset),Doc.Source={'Mov'},&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt;//MovementAggr={'Receptions'},%Time.Type={'R12'},Time.Month=, Time.Year=,&amp;nbsp; MaterialGroupAggr={'Paper'}, %Time.Key={"&amp;gt;=$(=num(MonthStart(AddMonths(Max(%Time.Evo.YearMonth),-5)))) &amp;lt;=$(=floor(MonthEnd(AddMonths(Max(%Time.Evo.YearMonth),0))))"}&amp;gt;}$(='#MovQty_'&amp;amp;%Units))), %Time.Evo.Month, Material.Code)))&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt;//,'#')=0&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt;AND&amp;nbsp; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt;SUM(AGGR(FABS(sum({$&amp;lt;$(rMovementsReset),$(tSetStockCP),Doc.Source={'MovR6'},%Time.Type={'R12'}, MaterialGroupAggr={'Paper'}, MovementAggr={'Consumptions'}&amp;gt;}#Qty_Base_Unit)),%Time.Evo.Month, Material.Code))&amp;gt;0,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt;(sum({$&amp;lt;Time.Quarter=,Time.Year=,Time.Month=,Time.YearMonth=,Time.Date=&amp;gt;}&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt; aggr( &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt; sum({&amp;lt; $(rPositionsReset),Doc.Source={'Pos'},Time.Date=,$(tSetStockCP), MaterialGroupAggr={'Paper'}, Pos.EndMonth.Flag={'X'},%Units={"$(=only(%Units))"}, %Time.Type={'R12'}&amp;gt;}&amp;nbsp; $(='#Qty_'&amp;amp;%Units)),%Time.Evo.Month, Material.Code)))&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt;, 0)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;STRONG style="color: #ff0000;"&gt;, Material.TopReference.Code, %Time.Evo.Month))&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Jul 2018 19:58:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-aggr-with-conditions/m-p/120431#M763382</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2018-07-26T19:58:38Z</dc:date>
    </item>
    <item>
      <title>Re: Sum aggr with conditions</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-aggr-with-conditions/m-p/120432#M763383</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Sunny! &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It seems to be working. I'll perform other tests and get back to you with more feedback.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 29 Jul 2018 20:19:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-aggr-with-conditions/m-p/120432#M763383</guid>
      <dc:creator>luciana_lima</dc:creator>
      <dc:date>2018-07-29T20:19:34Z</dc:date>
    </item>
    <item>
      <title>Re: Sum aggr with conditions</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-aggr-with-conditions/m-p/120433#M763384</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sounds good &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Jul 2018 17:23:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-aggr-with-conditions/m-p/120433#M763384</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2018-07-30T17:23:55Z</dc:date>
    </item>
  </channel>
</rss>

