Calculate Aggregates using Count() in SSRS

  • I need to create an SSRS report that will display a count of new concacts added in

    the last 30 days and who also subcribed to the services provided by the

    company. They must be by regions. I have these two scripts to get the data i

    want on different datasources. seperately they give me the output I want. but

    if i add the third column in the layout when designing the report, being now

    the number of subcribers per region i get the Sum instead of the count per

    region. Here is my code. The table should have these columns; Region, No. of

    New Contacts, No. of New Subscribers.

    SELECT COUNT(*) AS New_contact, new_regionidname

    FROM FilteredContact

    WHERE (DATEDIFF(day, createdon, GETDATE()) < 30)

    GROUP BY new_regionidname

    SELECT COUNT(*) AS New_Subscribers, new_regionidname

    FROM FilteredContact

    WHERE (DATEDIFF(day, new_subcribtiondate, GETDATE()) < 30)

    GROUP BY new_regionidname

    Many thaks

  • You can replace SUM by COUNT

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply