Lookup function in SSRS report

孤街醉人 提交于 2019-12-05 19:43:49

The first two values of the lookup function must refer to an identifying value in a column. In your case the City names must be in both datasets. Think of that as a primary key. The third value is the one you want to display from the second dataset. So it should look more like this:

=Lookup(Fields!CityColumn.Value, Fields!CityColumn.Value, Fields!CountColumn.Value, "Dataset1")

Make sure that Dataset1 has the column named CountColumn that you are trying to lookup. Keep in mind that this only looks up individual rows, not aggregates. If you want to work with aggregates you can do that on top of the lookup function.

EDIT:

Since Lookup functions are not allowed in calculated fields, you'll need to use it in the Value expression in your pie chart. It should look like this:

Note that the lookup function has to be in an aggregate like a sum function for it to work as a chart value.

Instead of adding it as a calculated field in the DataSet, simply add the expression into an empty column within the details rows of the report.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!