title: Create own grouping in Qlik
body: <p>I have a dimension</p>
  
  <pre><code>Group:
  A
  B
  C
  D
  </code></pre>
  
  <p>And Data:</p>
  
  <pre><code>+----+--------+-------+
  | ID | Amount | Group |
  +----+--------+-------+
  |  1 |     10 | A     |
  |  1 |     20 | C     |
  |  2 |     30 | A     |
  |  3 |     40 | A     |
  |  3 |     50 | B     |
  +----+--------+-------+
  </code></pre>
  
  <p>In my data, it will not have group <code>D</code> exists, the logic will be if exists in group <code>A</code>, but didn't exists in group <code>B or C</code>, then it will classify to group <code>D</code></p>
  
  <p>in above example, it should have a "hidden" data as </p>
  
  <pre><code>+----+--------+-------+
  | ID | Amount | Group |
  +----+--------+-------+
  |  2 |     10 | D     |
  +----+--------+-------+
  </code></pre>
  
  <p>I know that I can create that in <code>Load</code> script, but my data are stored as month by month, which means it can create triple or more dummy data.</p>
  
  <p><em>Question</em><br>
  So is it possible to use the expression to create grouping?</p>
  
  <p>In my bar chart, I have a dimension:</p>
  
  <pre><code>=IF(Group = 'A', null(), Group)
  </code></pre>
  
  <p>For measure, my idea it may be</p>
  
  <pre><code>Group D:
  sum({$&lt;Group = 'A'&gt;} Amount) - sum({$&lt;Group = - 'A', ID = P({$&lt;Group = 'A'&gt;} ID)&gt;} Amount)
  Other Group:
  sum({$&lt;Group = - 'A', $&lt;ID = P({$&lt;Group = 'A'&gt;} ID)&gt;} Amount)
  </code></pre>
  
  <p>result table:</p>
  
  <pre><code>+-------+--------+
  | Group | Amount |
  +-------+--------+
  | B     |     50 |
  | C     |     20 |
  | D     |     30 |
  +-------+--------+
  </code></pre>
  
  <p>underlying table:</p>
  
  <pre><code>+----+--------+-------+
  | ID | Amount | Group |
  +----+--------+-------+
  |  1 |     20 | C     |
  |  2 |     30 | D     |
  |  3 |     50 | B     |
  +----+--------+-------+
  </code></pre>