Answered by:
Lookup on two fields from datasets in SSRS 2008R2

Question
-
Hello,
I can do a lookup in SSRS 2008R2 for a single field to lookup on, but I have two fields to lookup on and I trying to figure it at. Can anyone assist me. For example
Dataset1 I have two fields: "Company", "Storage Unit" I need to pick up "Amount" from Dataset2 that has "Company", "Storage Unit", "Amount" any tips I will appreciate. Thank you in advance.
Saturday, January 16, 2016 6:25 PM
Answers
-
Hi Donalejandro,
According to your description, you need to lookup a value based on multiple conditions in SQL Server Reporting Services report, right?
Generally, we can add one condition into lookup function. To workaround this issue, we can conbine two condition into one condition. I have tested it on my local environmentt. Here is the sample expression for you reference.
=lookup(Fields!Company.Value+"-"+Fields!Storage_Unit.Value,Fields!Company.Value+"-"+Fields!Storage_Unit.Value,Fields!Amount.Value,"Destination")
If you have any questions, please feel free to ask.
Regards,
Charlie Liao
TechNet Community Support- Proposed as answer by Charlie Liao Monday, January 25, 2016 8:10 AM
- Marked as answer by Charlie Liao Tuesday, February 16, 2016 2:12 AM
Sunday, January 17, 2016 6:35 AM -
Hi,
you can write expressions as suggested by Charlie Liao or you can create Calculated fields and use them in your expressions.
Display data on a tablix from two datasets in ssrs report by joining on Multi columns
Good Luck!
TechBrothersIT.com- Proposed as answer by Charlie Liao Monday, January 25, 2016 8:10 AM
- Marked as answer by Charlie Liao Tuesday, February 16, 2016 2:12 AM
Wednesday, January 20, 2016 4:24 AM -
Hello,
Follow this link
http://www.bi-rootdata.com/2012/10/lookup-function-in-ssrs.html
blog:My Blog/
Hope this will help you !!!
Sanjeewan- Proposed as answer by Charlie Liao Monday, January 25, 2016 8:10 AM
- Marked as answer by Charlie Liao Tuesday, February 16, 2016 2:12 AM
Wednesday, January 20, 2016 5:48 AM
All replies
-
Hi Donalejandro,
According to your description, you need to lookup a value based on multiple conditions in SQL Server Reporting Services report, right?
Generally, we can add one condition into lookup function. To workaround this issue, we can conbine two condition into one condition. I have tested it on my local environmentt. Here is the sample expression for you reference.
=lookup(Fields!Company.Value+"-"+Fields!Storage_Unit.Value,Fields!Company.Value+"-"+Fields!Storage_Unit.Value,Fields!Amount.Value,"Destination")
If you have any questions, please feel free to ask.
Regards,
Charlie Liao
TechNet Community Support- Proposed as answer by Charlie Liao Monday, January 25, 2016 8:10 AM
- Marked as answer by Charlie Liao Tuesday, February 16, 2016 2:12 AM
Sunday, January 17, 2016 6:35 AM -
Thanks Charlie,
I will give try on this. I really appreciate your help. Thanks again.
Sunday, January 17, 2016 7:19 AM -
Hi,
you can write expressions as suggested by Charlie Liao or you can create Calculated fields and use them in your expressions.
Display data on a tablix from two datasets in ssrs report by joining on Multi columns
Good Luck!
TechBrothersIT.com- Proposed as answer by Charlie Liao Monday, January 25, 2016 8:10 AM
- Marked as answer by Charlie Liao Tuesday, February 16, 2016 2:12 AM
Wednesday, January 20, 2016 4:24 AM -
Hello,
Follow this link
http://www.bi-rootdata.com/2012/10/lookup-function-in-ssrs.html
blog:My Blog/
Hope this will help you !!!
Sanjeewan- Proposed as answer by Charlie Liao Monday, January 25, 2016 8:10 AM
- Marked as answer by Charlie Liao Tuesday, February 16, 2016 2:12 AM
Wednesday, January 20, 2016 5:48 AM