I have denormalized dataset:
ID, PaperId, PaperTitle, IsDelivered, IsRejected
1 123 AAA 1 1
2 123 AAA 1 0
3 111 BBB 1 0
4 111 BBB 1 0
5 123 AAA 1 0
6 155 CCC 1 0
7 123 AAA 1 1
8 155 CCC 1 0
9 155 CCC 1 0
I have grouped at the table level based on PaperId - to sum "IsDelivered - IsRejected" for Evrey Paper:
PaperTitle, Count (IsDelivered - IsRejected)
AAA 2
BBB 2
CCC 开发者_StackOverflow社区 3
Now how do I add filters to this group? Lets say I just want to see top 1 paper - based on the "count":
PaperTitle, Count (IsDelivered - IsRejected)
CCC 3
You can add a server-side filter.
For top-n filter, add parameter @TopCount and convert your dataset query into an expression. Something like:
="SELECT TOP " & @Parameter!TopCount.Value & " PaperTitle, CountValue FROM PaperTable ORDER BY CountValue"
HTH.
精彩评论