SQL Member Count by Month


  • Hello,

    I have a table with member's effective date, termination date, plan and name, something like below.

    I would like to know how many members exist by month based on the effective and terminate date.

    Then, need to develop a report in SSRS with parameters;

    if a user select a parameter from and to date as below, the report will populate the sum of members who are active in the month.

    I believe that I need to query in SQL to create a column that somehow be able to count members monthly..

    but I am not sure how.

    What is the best way? Any advise please?

    Friday, June 13, 2014 8:39 PM

All replies

  • Hi YJB5151,

    When populating the report dataset, we need to add another two columns: one to represent the current Year, and the other one to represent the current month. Besides, the query groups by Plan column, Name column, Year column, and Month column.

    In the report, we drag a Matrix to the design surface, add field Name to the row group and Month field to the column group. Then, add a parent row group that groups on filed Plan, and a parent column group that groups on field Year. In the data area of the matrix, fill in the cell with expression =Count(Fileds!Effective.Value).

    Add two static rows outside the row groups: one for Plan A and one for Plan B. In the proper cell of the Plan A row, input the expression: =sum(iif(Fileds!Pan.Value="Plan A", 1,0)). In the proper cell of the Plan B row, input the expression: =sum(iif(Fileds!Pan.Value="Plan B", 1,0)).

    Hope this helps.


    Mike Yin
    TechNet Community Support

    Friday, June 20, 2014 7:45 AM