A client contacted me regarding an issue of returning the previous row data in their
SQL server reporting services 2017 report.
Solution:
SSRS has a function Previous(), that allows one to return the previous row value, well in principle.
As with most things with SSRS if your report is simple than these functions work fine, but as soon as you start adding groups into tables, or work with matrix, then things get a little more complicated.
In this case the report was based on a report with a number of groupings, and as good as SSRS is, one thing it's not is intuitive.
To resolve this issue,
=Previous(First(Fields!Fieldname.Value)
Using the First() function ensures that SSRS looks at the previous row group
If you have any questions, leave us a comment below, or need any assistance, please do not hesitate to Contact Us |
Hi Nitish,
Thank you for your enquiry.
Unfortunately there no is facility/function within SQL Server Reporting Services to do this directly.
However you can achieve this in your dataset, using the SQL LAG() function, along with the PARTITION by clause and then base you report on that:
LAG(TableName.FieldName, 2,0) |