Click here to monitor SSC
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in
Home       Members    Calendar    Who's On

Add to briefcase

Pass Parameter for two different Datasets Expand / Collapse
Posted Monday, September 16, 2013 10:29 AM


Group: General Forum Members
Last Login: Wednesday, November 30, 2016 3:27 PM
Points: 406, Visits: 1,217
I have two seperate datasets :
Dataset1 and Dataset 2 and want to display results from both of them for the same values.
Here is what I have done :

Created Dataset3 and written a query where I pass the parameters to get two combo boxes on the report to fetch values.
On dataset 1 , I added Filter with the expression :
=First(Fields!ProdNbr.Value, "Dataset3")

But it gives me an error : Aggregate functions cannot be used in dataset filters .
Any ideas???
Post #1495183
Posted Tuesday, September 17, 2013 3:29 AM
Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Friday, November 18, 2016 1:24 AM
Points: 3,656, Visits: 1,510
If you want to produce a join like structure between the two datasets then either:

- create a join within a single dataset if the sources are compatible (i.e. both from same SQL server etc)
- use one of the SSRS lookup expressions to access the columns returned from dataset2 for the equivalent ProdNbr is dataset1.


DataSet1 : ProductNbr, Name, Color, ListPrice
DataSet2 : ProductNbr, QuantitySold, SalesAmount

1. Create a table and add the columns from DataSet1
2. Add a additional column to the table and add the expression as shown below. The function is used as :

= LOOKUP( FieldInCurrentDataSet, FieldInTargetDataSet, FieldToReturnFromTargetDataSet, "NameOfTargetDataSet")

= LOOKUP( Fields!ProdNbr.Value, Fields!ProdNbr.Value, Fields!QuantitySold.Value, "DataSet2")

3. If you want to return multiple values evaluate the use of LOOKUPSET and MULTILOOKUP as well.

If this is not what you were looking for the please reply with more details and I will try to help.


Post #1495415
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse