<?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 Expression in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/conditional-Aggr-Expression/m-p/1178807#M382361</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;Hi All,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;I have a following expression&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; color: #000000;"&gt;=&lt;SPAN style="color: #3366ff;"&gt;sum&lt;/SPAN&gt;(&lt;SPAN style="color: #3366ff;"&gt;Aggr&lt;/SPAN&gt;(&lt;SPAN style="color: #800000;"&gt;[Order Product Cost]&lt;/SPAN&gt;, &lt;SPAN style="color: #800000;"&gt;OrderId&lt;/SPAN&gt;, &lt;SPAN style="color: #800000;"&gt;[Order Product Cost]&lt;/SPAN&gt;))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;I use this expression in straight table and I have &lt;SPAN style="color: #800000;"&gt;[Product Name]&lt;/SPAN&gt; as dimension so this gives me total cost by each product name that have been ordered.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;Now I want to add an if condition in the above expression to only show those product names where orders have been cancelled&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Data Model&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;OrderId may repeat multiple times becasue an order can have more then 1 products. and each order contains OrderStatusId&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OrderStatusId 5 = cancelled.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 06 Jul 2016 00:24:12 GMT</pubDate>
    <dc:creator />
    <dc:date>2016-07-06T00:24:12Z</dc:date>
    <item>
      <title>conditional Aggr Expression</title>
      <link>https://community.qlik.com/t5/QlikView/conditional-Aggr-Expression/m-p/1178807#M382361</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;Hi All,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;I have a following expression&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; color: #000000;"&gt;=&lt;SPAN style="color: #3366ff;"&gt;sum&lt;/SPAN&gt;(&lt;SPAN style="color: #3366ff;"&gt;Aggr&lt;/SPAN&gt;(&lt;SPAN style="color: #800000;"&gt;[Order Product Cost]&lt;/SPAN&gt;, &lt;SPAN style="color: #800000;"&gt;OrderId&lt;/SPAN&gt;, &lt;SPAN style="color: #800000;"&gt;[Order Product Cost]&lt;/SPAN&gt;))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;I use this expression in straight table and I have &lt;SPAN style="color: #800000;"&gt;[Product Name]&lt;/SPAN&gt; as dimension so this gives me total cost by each product name that have been ordered.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;Now I want to add an if condition in the above expression to only show those product names where orders have been cancelled&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Data Model&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;OrderId may repeat multiple times becasue an order can have more then 1 products. and each order contains OrderStatusId&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OrderStatusId 5 = cancelled.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Jul 2016 00:24:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/conditional-Aggr-Expression/m-p/1178807#M382361</guid>
      <dc:creator />
      <dc:date>2016-07-06T00:24:12Z</dc:date>
    </item>
    <item>
      <title>Re: conditional Aggr Expression</title>
      <link>https://community.qlik.com/t5/QlikView/conditional-Aggr-Expression/m-p/1178808#M382362</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Maybe this one:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; color: #000000;"&gt;=&lt;SPAN style="color: #3366ff;"&gt;sum&lt;/SPAN&gt;({&amp;lt; [OrderStatusId 5] = {'cancelled'}&amp;gt;} &lt;SPAN style="color: #3366ff;"&gt;Aggr&lt;/SPAN&gt;(&lt;SPAN style="color: #800000;"&gt;[Order Product Cost]&lt;/SPAN&gt;, &lt;SPAN style="color: #800000;"&gt;OrderId&lt;/SPAN&gt;, &lt;SPAN style="color: #800000;"&gt;[Order Product Cost]&lt;/SPAN&gt;))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Jul 2016 05:26:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/conditional-Aggr-Expression/m-p/1178808#M382362</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2016-07-06T05:26:33Z</dc:date>
    </item>
    <item>
      <title>Re: conditional Aggr Expression</title>
      <link>https://community.qlik.com/t5/QlikView/conditional-Aggr-Expression/m-p/1178809#M382363</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Marcus it worked after little tweak in your expression because my mistake.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My explanation was not that good.. so just updating my question that the Order Status field name is &lt;STRONG&gt;OrderStatusId&lt;/STRONG&gt; not &lt;STRONG&gt;OrderStatusId 5 &lt;/STRONG&gt;and OrderStatusId has values 1 to 5 and value 5 means cancelled &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;so I updated your expression with following and it worked.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: 'courier new', courier; font-size: 13px;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="font-size: 13px; font-family: 'courier new', courier; color: #3366ff;"&gt;sum&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-family: 'courier new', courier; font-size: 13px;"&gt;({&amp;lt; [OrderStatusId] = {5}&amp;gt;} &lt;/SPAN&gt;&lt;SPAN style="font-size: 13px; font-family: 'courier new', courier; color: #3366ff;"&gt;Aggr&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-family: 'courier new', courier; font-size: 13px;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="font-size: 13px; font-family: 'courier new', courier; color: #800000;"&gt;[Order Product Cost]&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-family: 'courier new', courier; font-size: 13px;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="font-size: 13px; font-family: 'courier new', courier; color: #800000;"&gt;OrderId&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-family: 'courier new', courier; font-size: 13px;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="font-size: 13px; font-family: 'courier new', courier; color: #800000;"&gt;[Order Product Cost]&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-family: 'courier new', courier; font-size: 13px;"&gt;))&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Jul 2016 08:39:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/conditional-Aggr-Expression/m-p/1178809#M382363</guid>
      <dc:creator />
      <dc:date>2016-07-06T08:39:00Z</dc:date>
    </item>
  </channel>
</rss>

