title: How do I show distinct week?
body: <p>I am executing the SQL code based on "<strong>Running total</strong>" concept.My code is calculating accurate running total but i need to show the running total only after completion of every week not by dates.?</p>
  
  <pre><code>Select DISTINCT SD1.[Week], 
      SD1.[Allocation], 
      SD1.[Subsidiaries],
      SD1.[Month],
      SD1.[Date],
      (SD1.[Daily Sale]+IsNull(SUM(SD2.[Daily Sale]),0)) as 'Running Total'
  from [dbo].[Solar data] SD1 
      left join [dbo].[Solar data] SD2 on SD1.[Subsidiaries]=SD2.[Subsidiaries]
          and SD2.[Date]&amp;lt;SD1.[Date] And SD1.[Month]=SD2.[Month]
  where SD1.[Subsidiaries]='WCL' 
  group by SD1.[Allocation],
      SD1.[Month],
      SD1.[Subsidiaries],
      SD1.[Daily Sale],
      SD1.[Week],SD1.[Date]
  order by SD1.[Week]
  </code></pre>
  
  <p><br></p>
  
  <pre><code>+---------------+------------+------------+-----------+--------+-------+
  | Subsidiaries  | Allocation | Daily Sale |   Date    | Month  | Week  |
  +---------------+------------+------------+-----------+--------+-------+
  | WCL           |       1075 | 44.93      | 2-Jan-17  | Jan-17 | Week1 |
  | WCL           |       1075 | 44.51      | 3-Jan-17  | Jan-17 | Week1 |
  | WCL           |       1075 | 53.68      | 8-Jan-17  | Jan-17 | Week2 |
  | WCL           |       1075 | 41.45      | 9-Jan-17  | Jan-17 | Week2 |
  | WCL           |       1075 | 40.97      | 15-Jan-17 | Jan-17 | Week3 |
  | WCL           |       1075 | 55.9       | 16-Jan-17 | Jan-17 | Week3 |
  | WCL           |       1075 | 43.89      | 22-Jan-17 | Jan-17 | Week4 |
  | WCL           |       1075 | 44.36      | 23-Jan-17 | Jan-17 | Week4 |
  | WCL           |       1075 | 35.13      | 29-Jan-17 | Jan-17 | Week5 |
  +---------------+------------+------------+-----------+--------+-------+
  </code></pre>
  
  <p>Expected Result:</p>
  
  <pre><code>+--------+---------------+
  | Week   | Running total |
  +--------+---------------+
  | Week1  | 89.44         |
  | Week2  | 184.57        |
  | Week3  | 281.44        |
  | Week4  | 369.69        |
  | Week5  | 404.82        |
  +--------+---------------+                  
  </code></pre>