title: How to display sequential ROW_NUMBER if duplicates ID's are not in a query
body: <p>I dont really know how to correctly explain my problem, I used subquery to bring only distinct ProducerCode field. 
  But now I just need basically row identifier with sequence number, but when I use ROW_NUMBER function it gives me weird numbers.
  Using SQL 2012, SSRS 2010 
  Here is my code:</p>
  
  <pre><code>    ;WITH cte_Counts   --C
  AS 
      (
          SELECT      ROW_NUMBER() OVER ( ORDER BY ProducerCode) as RowNum,
                      ProducerCode, 
                      ProducerName, 
                      COUNT (distinct ControlNo) as Submissions,
                      SUM(CASE WHEN QuotedPremium IS NOT NULL THEN 1 ELSE 0 END) as Quotes,
                      SUM(CASE WHEN Status IN ('Bound','Cancelled','Notice of Cancellation','Non-Renewed') THEN 1 ELSE 0 END ) AS Binds,
                      SUM(CASE WHEN  Status = 'Declined' THEN 1 ELSE 0 END ) as  Declines
          FROM        ClearanceReportMetrics
          WHERE       YEAR(EffectiveDate)=2016
                      AND CompanyLine = 'Arch Insurance Company'
          GROUP BY    ProducerCode,ProducerName
      )
  
  SELECT   * FROM 
              (
                  SELECT  RowNum,
                          ROW_NUMBER() OVER (PARTITION BY ProducerCode ORDER BY Submissions  DESC) as num,
                          ProducerCode,
                          ProducerName as 'Producer',         
                          Submissions,
                          Quotes,
                          Binds,
                          Declines,
                          COALESCE(CAST(Binds as FLOAT) /NULLIF(Submissions,0),0) as 'Sub. to Bind',
                          COALESCE(CAST(Quotes as FLOAT) /NULLIF(Submissions,0),0) as 'Sub. to Qt',
                          COALESCE(CAST(Binds as FLOAT) /NULLIF(Quotes,0),0) as 'Qt to Bind',
                          COALESCE(CAST(Declines as FLOAT) /NULLIF(Submissions,0),0) as 'Sub to Dec'
  
                  FROM    cte_Counts
                      ) a 
  WHERE a.num=1               
  ORDER BY    
              Submissions DESC
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/y6rn4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/y6rn4.png" alt="enter image description here"></a></p>
  
  <p>I tried to achieve that in SSRS with expression </p>
  
  <pre><code>=RowNumber(Nothing)
  </code></pre>
  
  <p>But it skips numbers as well:
  <a href="https://i.stack.imgur.com/j1yHJ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/j1yHJ.png" alt="enter image description here"></a></p>
  
  <p>How can I display just sequence row number?</p>