Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SSRS Lookup Based on Multiple Conditions

I have a dataset (Volume) looks like this:

enter image description here

In my report, what I want to get is this:

enter image description here

The Lookup expression: =Lookup (Fields!Id.Value, Fields!Id.Value, Fields!Volume.Value,"Volume") can only lookup on ID. Is there any way I can do lookup on ID first, and then lookup on Sub_Group to get the correct Volume? Thank you.

like image 348
C.C Avatar asked Feb 29 '16 12:02

C.C


People also ask

How to use lookup in ssrs report?

To retrieve multiple values for a single name or key field where there is a 1-to-many relationship, use LookupSet Function (Report Builder and SSRS). To call Lookup for a set of values, use Multilookup Function (Report Builder and SSRS).

What is Multilookup?

MultiLookup is the equivalent of calling Lookup for a set of names or keys. For example, for a multivalue parameter that is based on primary key identifiers, you can use Multilookup in an expression in a text box in a table to retrieve associated values from a dataset that is not bound to the parameter or to the table.

What is ReportItems in SSRS?

The ReportItems built-in collection is the set of text boxes from report items such as rows of a data region or text boxes on the paginated report design surface. The ReportItems collection includes text boxes that are in the current scope of a page header, page footer, or report body.


1 Answers

You can Lookup using multiple fields if you concatenate all the necessary fields in the first and second Lookup parameter.

=Lookup(Fields!ID.Value & Fields!SUB_GROUP.Value, Fields!ID.Value & Fields!SUB_GROUP.Value, Fields!VOLUME.Value, "Volume")

Alternatively, you can concatenate all the necessary fields in your dataset and use that for your Lookup.

like image 137
Pete Rennard-Cumming Avatar answered Oct 01 '22 05:10

Pete Rennard-Cumming