Solved

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

Posted on 2013-11-18
3
2,455 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

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

Suggested Solutions

JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
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.

752 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