title: Receive quantity of lines of query
body: <p>Promt please.
  I have an  query: <code>SELECT MAX(FPS.EndDateKey) WHERE FPS.EndDateKey &lt;&gt;-2</code>
  I need to receive quantity of lines of this query in other query: </p>
  
  <pre><code>SELECT INVS.ParticipantKey, MIN(CASE WHEN FPS.EndDateKey &lt;&gt; -2 AND FPS.EndDateKey &gt; FPS.DefinedEndDateKey
            AND FPS.EndDateKey &gt; @PeriodEndDateKey AND FPS.DefinedEndDateKey &lt; @PeriodEndDateKey
            THEN 1 
            ELSE 0
           END) as InRunout,
           MAX(CASE WHEN DP.AccountKey = 6 THEN 1 ELSE 0 END) as HasHSA,
           MAX(FPS.StartDateKey) as MostCurrentEnrollment,
           CASE WHEN EXISTS(SELECT MAX(FPS.EndDateKey) WHERE FPS.EndDateKey &lt;&gt;-2) THEN 1 ELSE 0 END  AS CurrentPlanYear
    FROM SupportFile.InvoicableSubscription as INVS
    INNER JOIN Evolution1.FactProductSubscription as FPS ON FPS.SubscriptionKey = INVS.SubscriptionKey AND FPS.StartDateKey = INVS.StartDateKey
    INNER JOIN Evolution1.DimProduct as DP ON DP.ProductKey = FPS.ProductKey
    GROUP BY INVS.ParticipantKey, FPS.EndDateKey
  </code></pre>
  
  <p>How I am able to do it? Prompt please. Thanks</p>