SSRS: get values ​​from a specific row of a DataSet?

My dataset currently has 12 rows of data. Each of them presents data for a month. I would like to have the variance of the column between the rows, with the rows being the last and last, but, for example, the data of the last month and previous month.
It would be simple if I worked on tablix, but it is not. I need these values ​​for the text box.

Any ideas on this anyone?

+7
source share
1 answer

Hope you are using SSRS 2008R2:

R2 introduced a search function that is ideal for this scenario.

=Lookup( Fields!ProductUID.Value ,Fields!ProductID.Value,Fields!Price.Value,"PriceDataSet") 

The Lookup function above will check the first parameter ("Fields! ProductUID.Value") in the current data set, then find the corresponding value in the field specified in the second parameter ("Fields! ProductID.Value") in the data set specified in the fourth parameter. Then the value of the third parameter is evaluated in this row of the data set and returned.

A bit confusing, but very helpful.

In your case, you can use this in a text field with a calculated static number:

 =Lookup( Month(DateAdd(DateInterval.Month, -1, GetDate())), Fields!MonthID.Value, Fields!Name.Value, "DataSet1") 

This should calculate the number for the last month, and then look for a match in DataSet1.

+13
source

All Articles