title: SQL SERVER: Count data with the same group using Partition
body: <p><img src="https://i.stack.imgur.com/MSQMF.jpg" alt="enter image description here"></p>
  
  <p>Based on the picture above, I need to come up with the CountRemarks Column where in it will count the number of similar data in Remarks column PER LOCATION. So, Tenant 1 and 2 have total of 2 in Location "EM" and total of 1 only for tenant 3 in the same location. Same counting for Location "CW". </p>
  
  <p>Unfortunately, I have come up to this output, counting all with the same remnarks and DISREGARDING the Location.</p>
  
  <p><img src="https://i.stack.imgur.com/BI8aa.jpg" alt="enter image description here"></p>
  
  <p>This is the portion in the code that I used</p>
  
  <pre><code> CASE
          WHEN [Remarks]  &gt;= 4 THEN Remarks 
          ELSE count(Remarks) OVER(PARTITION BY [Remarks] )
  END as 'CountRemark'  
  </code></pre>