Solved

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

Posted on 2013-11-18
3
2,411 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

Forrester Webinar: xMatters Delivers 261% ROI

Guest speaker Dean Davison, Forrester Principal Consultant, explains how a Fortune 500 communication company using xMatters found these results: Achieved a 261% ROI, Experienced $753,280 in net present value benefits over 3 years and Reduced MTTR by 91% for tier 1 incidents.

Question has a verified solution.

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

Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

749 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