title: Count rows with equal values in a window function
body: <p>I have a time series in a SQLite Database and want to analyze it.</p>
  <p>The important part of the time series consists of a column with different but not unique string values.
  I want to do something like this:</p>
  <pre><code>Value  concat  countValue
  
  A      A       1
  A      A,A     1
  B      A,A,B   1
  B      A,B,B   2
  B      B,B,B   3
  C      B,B,C   1
  B      B,C,B   2
  </code></pre>
  <p>I don't know how to get the countValue column. It should count all Values of the partition equal to the current rows Value.</p>
  <p>I tried this but it just counts all Values in the partition and not the Values equal to this rows Value.</p>
  <pre><code>SELECT 
      Value,
      group_concat(Value) OVER wind AS concat,
      Sum(Case When Value Like Value Then 1 Else 0 End) OVER wind AS countValue
  FROM TimeSeries
  WINDOW
      wind AS (ORDER BY date ROWS BETWEEN 2 PRECEDING AND CURRENT ROW)
  ORDER BY 
      date
  ;
  </code></pre>
  <p>The query is also limited by these factors:</p>
  <ol>
  <li>The query should work with any amount of unique Values</li>
  <li>The query should work with any Partition Size (ROWS BETWEEN n PRECEDING AND CURRENT ROW)</li>
  </ol>
  <p>Is this even possible using only SQL?</p>