Home Forums SQL Server 2005 SQL Server Express Comparing data between 2 datasets into a table - SQL reporting services RE: Comparing data between 2 datasets into a table - SQL reporting services

  • This is a bit old but no-one has replied so I'll let you know my various ways of doing this.

    Sounds like you could use EXCEPT in this case.

    Instead of having two datasets, you can combine them into one.

    e.g.

    Select Date1 from Table1

    EXCEPT

    Select Date2 from Table2

    If there are other fields you need in the table you can use the EXCEPT as a subquery e.g.

    Select Date1, field2, field3 from Table1 where Date1 in

    (

    Select Date1 from Table1

    EXCEPT

    Select Date2 from Table2)

    There are some other tricks to working with multiple datasets in SSRS. First you can reference cells directly. It helps to name the cells so they aren't just called e.g. Textbox37.If you named it SaleDate for example:

    You can use ReportItems!SaleDate.Value in expressions. This option is hidden unfortunately, you just need to know about it apparently. It's probably not ideal to use references to named cells, but if you change the name of the cell the error message is pretty explicit.

    You can also reference other Datasets in expressions but it seems to be fairly limited to overall aggregates. In the expression editor you can choose "Datasets" under "Category" and then pick an item and aggregate value e.g. sum / first / average etc

    I was actually looking to see if there was a way to compare same groups between datasets. e.g. dataset2 Region Sales as a percentage of dataset1 Region Sales where they are both the same region. I'm trying to help a power user who has visually created this report with 3 MDX datasets in it so was trying to avoid the stored proc option so that this user can still see the queries and avoid my future involvement.