Solved

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

Posted on 2013-11-18
3
2,216 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
Comment Utility
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
Comment Utility
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
Comment Utility
I figured out how to do it myself.
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

728 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now