title: Calculating Average based on Condition in SAP HANA GRAPHICAL VIEW
body: <pre><code>ColumnA   ColumnB  ColumnC  ColumnD
       A         10       xyz      Ab
       A         20       def      Ab
       A         5        mno      Xy
       B         10       pqr      Ab
       B         40       abc      Xy
       C         10       uvw      Xy
  </code></pre>
  
  <p>I need to calculate total average as well as average for each value of ColumnD</p>
  
  <p>Total Average(divided by unique ColumnA):</p>
  
  <pre><code>(10+20+5+10+40+10)/3= 31.66
  </code></pre>
  
  <p>Now I need Average for Ab=> </p>
  
  <pre><code>(10+20+10)/2
  </code></pre>
  
  <p>Average for Xy=> </p>
  
  <pre><code>(5+40+10)/2
  </code></pre>
  
  <p>I made Calculated Column in Hana:</p>
  
  <p>Counter-> CA_Count on ColumnA(to get unique Count)
  CA_Avg -> </p>
  
  <pre><code>ColumnB/CA_Count
  </code></pre>
  
  <p>fo Avg of  Ab:
  CA_AVG_Ab :</p>
  
  <pre><code>if(ColumnD='Ab',CA_Avg,0)
  </code></pre>
  
  <p>but this Value is not coming corectly.</p>