Home Forums Reporting Services Reporting Services how to use seperate query to populate 3 values (columns) on one row RE: how to use seperate query to populate 3 values (columns) on one row

  • Add another row at the bottom of the report, and give it an expression along the lines of:

    =First(Fields!FieldName.Value, "DataSet2")

    Where DataSet2 is the dataset containing the second query.

    Can't remember the exact syntax. If you use the expression builder at the bottom of the expression pop up (use Datasets->etc etc) it should generate the correct syntax.

    There's probably a way to do it all in one query using ROLLUP but I'm not particularly good with that clause!

    Edit:

    Can also be done with UNION, might be easier than multiple datasets:

    select

    property_name,

    count(distinct lead_id) AS leads_sent,

    1 as OrderField

    from leadtracker

    group by property_name

    union all

    select 'Total', sum(DistinctLeads), 2

    from

    (

    select

    property_name,

    count(distinct lead_id) as DistinctLeads

    from leadtracker

    group by property_name

    ) dl

    union all

    select 'Total Unique Leads', count(distinct lead_id), 3

    from leadtracker

    order by OrderField, PropertyName