Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

SSRS Return Data from One Dataset where it does not exist in another

Posted on 2013-11-18
3
Medium Priority
?
2,672 Views
Last Modified: 2013-11-23
Hi, I am using Report Builder 3 on SQL 2008 and am wondering if it is possible to return values in one dataset based on whether the value is present in another dataset.

For example, my first dataset is the one my Tablix is based on and has a list of property references.

My second dataset just pulls through a list of property references that have a certain charge against them.

I don't want to see the properties in my first dataset if they exist in the second dataset?

Many thanks in Advance.
0
Comment
Question by:deborahhowson00
  • 2
3 Comments
 
LVL 12

Expert Comment

by:Tony303
ID: 39658604
Does the Query feeding the first dataset have the field that determines that a charge is against the property?

I would just filter your dataset that feeds the Tablix.

OR You could change the first query to include a nested query that excludes the properties with a charge.

Like this.

SELECT *
FROM yourfirstdatasetTable
WHERE ID NOT IN  (SELECT ID FROM yourseconddatasetTable WHERE ChargeOnProperty = 1)

Open in new window

0
 

Accepted Solution

by:
deborahhowson00 earned 0 total points
ID: 39658637
The trouble was that I couldn't start using SQL as I'm training 'non IT' users in how to create reports so had to do it using the GUI without using SQL statements that haven't been built in the Query Designer.  I have found the answer to my problem by filtering the TABLIX where the Property Reference <> (LOOKUP the Property Ref from my second dataset).  

You can't filter a dataset based on another dataset, but you can filter a tablix based on a lookup from another dataset which I didn't realise at the time.

I initially tried using a parameter to select the 'default values' (ie property refs) from my second dataset and then basing the first dataset on that parameter but the report kept timing out.  This method has worked for other smaller reports though!

Thanks anyway, cheers.
0
 

Author Closing Comment

by:deborahhowson00
ID: 39671161
I figured out how to do it myself.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Microsoft Access has a limit of 255 columns in a single table; SQL Server allows tables with over 255 columns, but reading that data is not necessarily simple.  The final solution for this task involved creating a custom text parser and then reading…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

971 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question