title: SQL Sum count of product by Member and product YTD of the product count
body: <pre class="lang-sql prettyprint-override"><code>SELECT DISTINCT 
    DMC.MEM_NBR, 
    FIRST_NAME, 
    LAST_NAME, 
    PRODUCT_DESC, 
    DD.YEAR_MONTH AS FILL_DATE, 
    FC.PRODUCT_NBR 
    CASE 
      WHEN CAST ((CURRENT_DATE - DOB.DATE_DATE) / 365.25 as Int) &gt;= 18  Then '18+'
      ELSE 'Less than 18'
    END MEM_AGE
  FROM FT_PRODUCT_CLAIM FC
  LEFT JOIN DIM_PRODUCT PRODUCT ON FC.PRODUCT_DIM_CK=PRODUCT.PRODUCT_DIM_CK
  LEFT JOIN DIM_MEMBER DMC ON DMC.MEMBER_DIM_CK = FC.MEMBER_DIM_CK 
  INNER JOIN DIM_DATE DD ON DD.DATE_DIM_CK = FC.PRODUCT_DATE_DIM_CK 
  INNER JOIN DIM_DATE DOB ON DOB.DATE_DIM_CK = DMC.BIRTH_DATE_DIM_CK 
  WHERE FC.PRODUCT_NBR IN (SELECT * FROM TBL_PRODUCT)
  AND FILL_DATE between 202001 and 202002
  AND MEM_AGE = '18+'
  ORDER BY FIRST_NAME
  </code></pre>
  
  <p>-- Questions: 
      ---COUNT HOW MANY PRODUCT IS ASSOCIATED TO A MEMBER VIA THE PRODUCT NUMBER
      ---WANT TO SUM UP THE COUNT OF THE UNIQUE PRODUCT  NBRS FOR EACH MEMBER(MBR_NBR) 
      ---THEN ADD A YTD FOR EACH SUMMED COUNT OF PRODUCT FOR MEMBER For each new month(Fill_Date)</p>