title: count dictinctly by group in xml bi publisher
body: <p>So I have to do a report that will display and count distinctly the CwaProductCode based on CwaChannel and CwaOrderType.</p>
  
  <p>Heres my xml:</p>
  
  <pre><code> &lt;OrderEntry-Orders&gt;
              &lt;CwaChannel&gt;Customer Portal&lt;/CwaChannel&gt;
              &lt;CwaOrderType&gt;UT Sales&lt;/CwaOrderType&gt;
              &lt;ListOfOrderEntry-LineItems&gt;
                      &lt;OrderEntry-LineItems&gt;
                              &lt;CwaLineTotalAmount2&gt;1000&lt;/CwaLineTotalAmount2&gt;
                              &lt;CwaProductCode&gt;001&lt;/CwaProductCode&gt;
                      &lt;/OrderEntry-LineItems&gt;
                      &lt;OrderEntry-LineItems&gt;
                              &lt;CwaLineTotalAmount2&gt;1000&lt;/CwaLineTotalAmount2&gt;
                              &lt;CwaProductCode&gt;005&lt;/CwaProductCode&gt;
                      &lt;/OrderEntry-LineItems&gt;
              &lt;/ListOfOrderEntry-LineItems&gt;
      &lt;/OrderEntry-Orders&gt;
      &lt;OrderEntry-Orders&gt;
              &lt;CwaChannel&gt;Customer Portal&lt;/CwaChannel&gt;
              &lt;CwaOrderType&gt;UT Sales&lt;/CwaOrderType&gt;
              &lt;ListOfOrderEntry-LineItems&gt;
                      &lt;OrderEntry-LineItems&gt;
                              &lt;CwaLineTotalAmount2&gt;1000&lt;/CwaLineTotalAmount2&gt;
                              &lt;CwaProductCode&gt;005&lt;/CwaProductCode&gt;
                      &lt;/OrderEntry-LineItems&gt;
              &lt;/ListOfOrderEntry-LineItems&gt;
      &lt;/OrderEntry-Orders&gt;
      &lt;OrderEntry-Orders&gt;
              &lt;CwaChannel&gt;Customer Portal&lt;/CwaChannel&gt;
              &lt;CwaOrderType&gt;UT Redemption&lt;/CwaOrderType&gt;
              &lt;ListOfOrderEntry-LineItems&gt;
                      &lt;OrderEntry-LineItems&gt;
                              &lt;CwaLineTotalAmount2&gt;1000&lt;/CwaLineTotalAmount2&gt;
                              &lt;CwaProductCode&gt;005&lt;/CwaProductCode&gt;
                      &lt;/OrderEntry-LineItems&gt;
              &lt;/ListOfOrderEntry-LineItems&gt;
      &lt;/OrderEntry-Orders&gt;
  </code></pre>
  
  <p>Heres my BIP code:</p>
  
  <pre><code>&lt;?for-each-group: OrderEntry-LineItems; CwaProductCode?&gt;
  &lt;?if:../../CwaOrderType='UT Sales' and ../../CwaChannel='Customer Portal'?&gt;
  &lt;?for-each: current-group()?&gt;
  &lt;?CwaProductCode?&gt;
  &lt;?xdoxslt:set_variable($_XDOCTX, 'countFund', xdoxslt:get_variable($_XDOCTX, 'countFund')+1)?&gt;
  &lt;?xdoxslt:set_variable($_XDOCTX, 'TotalCount', xdoxslt:get_variable($_XDOCTX, 'TotalCount')+1)?&gt;
  &lt;?xdoxslt:get_variable($_XDOCTX, 'countFund')?&gt;
  &lt;?xdoxslt:set_variable($_XDOCTX, 'countFund', 0)?&gt;
  &lt;?end if?&gt;
  &lt;?end for-each-group?&gt;
  &lt;?xdoxslt:get_variable($_XDOCTX, 'TotalCount')?&gt;
  </code></pre>
  
  <p>But the result came out as if there was no if condition.
  For example, the CwaProductCode will display the correct result, but it will count everything altogether as if there was no filtering at all.</p>
  
  <p>Not sure where went wrong.</p>