<?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 conditional aggr in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/conditional-aggr/m-p/293080#M1193553</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;i have a line chart that shows the average sales over the past X number of weeks... in my current case it's 26 weeks or 182 days...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;one of the lines will show the overall sales while the other lines are location-specific &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the expression for the overall line works fine&lt;/P&gt;&lt;P&gt;=aggr((calculation formula), date)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;however if i add &lt;/P&gt;&lt;P&gt;=aggr(if(location='A', (calculation formula)), date)&lt;/P&gt;&lt;P&gt;the line simply disappears&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in case u're wondering why im using date as the group, all records belonging to the same set are inserted at the same timing..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this is the dimension of the chart&lt;/P&gt;&lt;P&gt;=if(date&amp;gt;=Date(Today()-182) and date&amp;lt;=Date(Today()), workweek)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so i actually have the the current/latest week at the right end of the axis followed by the past 26 weeks...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;please advise if nested the if-condition in the wrong way or there's a proper way around this...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 16 Jun 2011 05:45:16 GMT</pubDate>
    <dc:creator />
    <dc:date>2011-06-16T05:45:16Z</dc:date>
    <item>
      <title>conditional aggr</title>
      <link>https://community.qlik.com/t5/QlikView/conditional-aggr/m-p/293080#M1193553</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;i have a line chart that shows the average sales over the past X number of weeks... in my current case it's 26 weeks or 182 days...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;one of the lines will show the overall sales while the other lines are location-specific &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the expression for the overall line works fine&lt;/P&gt;&lt;P&gt;=aggr((calculation formula), date)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;however if i add &lt;/P&gt;&lt;P&gt;=aggr(if(location='A', (calculation formula)), date)&lt;/P&gt;&lt;P&gt;the line simply disappears&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in case u're wondering why im using date as the group, all records belonging to the same set are inserted at the same timing..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this is the dimension of the chart&lt;/P&gt;&lt;P&gt;=if(date&amp;gt;=Date(Today()-182) and date&amp;lt;=Date(Today()), workweek)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so i actually have the the current/latest week at the right end of the axis followed by the past 26 weeks...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;please advise if nested the if-condition in the wrong way or there's a proper way around this...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2011 05:45:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/conditional-aggr/m-p/293080#M1193553</guid>
      <dc:creator />
      <dc:date>2011-06-16T05:45:16Z</dc:date>
    </item>
    <item>
      <title>conditional aggr</title>
      <link>https://community.qlik.com/t5/QlikView/conditional-aggr/m-p/293081#M1193554</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;normally the way you would use and if() clause in a calculation is as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[for the example I'll say your calculation forula = sum(sales)]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sum(sales)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;becomes&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sum(if(location='A', sales)).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so maybe you shoudl go from &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; aggr(sum (sales),date)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;to&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; aggr(sum(if(location='A',sales)),date)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;does that do the trick?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2011 06:25:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/conditional-aggr/m-p/293081#M1193554</guid>
      <dc:creator>pat_agen</dc:creator>
      <dc:date>2011-06-16T06:25:41Z</dc:date>
    </item>
    <item>
      <title>Re: conditional aggr</title>
      <link>https://community.qlik.com/t5/QlikView/conditional-aggr/m-p/293082#M1193555</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi pat thanks for the help...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this is the expression after adding in your suggestion, unfortunately it does not do the trick... the calculation goes wrong instead...&lt;/P&gt;&lt;P&gt;=aggr(&lt;/P&gt;&lt;P&gt;(sum(if(Site='A', field1))&lt;/P&gt;&lt;P&gt;/sum(if(Site='A', field2)))*&lt;/P&gt;&lt;P&gt;(sum(if(Site='A', field3))&lt;/P&gt;&lt;P&gt;/sum(if(Site='A', field4)))*&lt;/P&gt;&lt;P&gt;(sum(if(Site='A', field5))&lt;/P&gt;&lt;P&gt;/sum(if(Site='A', field6)))&lt;/P&gt;&lt;P&gt;, date)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i tried using set analysis instead of aggr, it works but the graph does not adjust itself according to selections&lt;/P&gt;&lt;P&gt;=(sum&lt;/P&gt;&lt;P&gt;({$&amp;lt;Site ={A}&amp;gt;} field1)&lt;/P&gt;&lt;P&gt;/sum({$&amp;lt;Site ={A}&amp;gt;} field2))*&lt;/P&gt;&lt;P&gt;(sum({$&amp;lt;Site ={A}&amp;gt;} field3)&lt;/P&gt;&lt;P&gt;/sum({$&amp;lt;Site ={A}&amp;gt;} field4))*&lt;/P&gt;&lt;P&gt;(sum({$&amp;lt;Site ={A}&amp;gt;} field5)&lt;/P&gt;&lt;P&gt;/sum({$&amp;lt;Site ={A}&amp;gt;} field6))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this was the original expression,&lt;/P&gt;&lt;P&gt;=aggr(&lt;/P&gt;&lt;P&gt;if(Site='A',&lt;/P&gt;&lt;P&gt;(sum(field1)&lt;/P&gt;&lt;P&gt;/sum(field2))*&lt;/P&gt;&lt;P&gt;(sum(field3)&lt;/P&gt;&lt;P&gt;/sum(field4))*&lt;/P&gt;&lt;P&gt;(sum(field5)&lt;/P&gt;&lt;P&gt;/sum(field6))&lt;/P&gt;&lt;P&gt;)&lt;/P&gt;&lt;P&gt;, date)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;oh and to add on, the date is actually part of a synthetic key that was automatically created by QV because i linked that field to the same field of a calendar table since QV's week system is different from what we want. not sure if this was part of the original problem though.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;with the original expression which did not appear on the chart, if i changed the date to another date field (for e.g. lastUpdated), the line actually appears but that isn't actually the group condition we want since we want to group by the record insertion date and follow our own calendar.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2011 06:48:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/conditional-aggr/m-p/293082#M1193555</guid>
      <dc:creator />
      <dc:date>2011-06-16T06:48:54Z</dc:date>
    </item>
    <item>
      <title>Re: conditional aggr</title>
      <link>https://community.qlik.com/t5/QlikView/conditional-aggr/m-p/293083#M1193556</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thanks to pat again &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;please ignore my previous post, i used the wrong field to aggregate&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2011 07:24:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/conditional-aggr/m-p/293083#M1193556</guid>
      <dc:creator />
      <dc:date>2011-06-16T07:24:47Z</dc:date>
    </item>
  </channel>
</rss>

