问题
I have one report in which I want to show 10 employees data which have max salary. I want to do this by SSRS please help me. Please do it by SSRS not by SSMS.
Thanks in Advance
回答1:
I'm assuming you have a Dataset with one row per employee which is sorted by salary, descending.
You can apply a TOP N
filter to the table and set this to 10; this should return only the first ten rows:
http://msdn.microsoft.com/en-us/library/ms156270(v=sql.100).aspx
You could also set the Hidden
attribute for the detail row in the table based on an expression that uses the RowNumber() function, e.g.
=IIf(RowNumber(Nothing) <= 10, False, True)
which should work, too.
http://msdn.microsoft.com/en-us/library/ms159225(v=sql.100).aspx
回答2:
Just adding my 5 cents (and a picture) here: I had an issue that the filter should be applied only for integers. So I applied a value conversion as shown below.
回答3:
For top 10 records from a dataset.
1: Go to the Row Group properties and add a filter on for TOP N .
Expression =Sum(Fields!ActualCost.Value)
2 . Sorting on "=Sum(Fields!ActualCost.Value)"
Field Name in Descending order.
来源:https://stackoverflow.com/questions/14225792/show-max-value-of-10-rows-in-ssrs