Rank numbering for sum of the Reporting Service Group
Hi all
Suppose I have a SP with this result set:
Region - City - Count - Rank
A - m - 30 - 4
A - n - 50 - 2
A - o - 20 - 5
B - x - 80 - 1
B - y - 40 - 3
(Rank created by sql server for Count column)
Now I create a rdl for this Query by a group for Region column:
Region - City - Count - Rank
A - m - 30 - 4
A - n - 50 - 2
A - o - 20 - 5
Sum(A) - 100 - ?
B - x - 80 - 1
B - y - 40 - 3
Sum(B) - 120 - ?
Now I want to ranking sum of the groups.
How can I fill ? signs?
Like this:
A - m - 30 - 4
A - n - 50 - 2
A - o - 20 - 5
Sum(A) - 100 - 2
B - x - 80 - 1
B - y - 40 - 3
Sum(B) - 120 - 1Each problem has a solution.
June 24th, 2012 12:50am
Hi There
Can you please give some more details, What do you mean by ranking sum
Sum(B) - 120 - 1 what do you mean by this even though b do have the rank of 1 and 3
Sum(A) - 100 - 2 what do you mean by this even though b do have the rank of 2 and 4 and 5
Please give some more details than someone might be able to help you out
Many thank
Syed Qazafi Anjum
However if you would like to put minimum of your rank with that group sum you can put expression like this
=cstr(Sum(Fields!count.Value)) +"-" +cstr(min(Fields!Rank.Value))
Free Windows Admin Tool Kit Click here and download it now
June 24th, 2012 1:23am
My query grouped by Region and City columns:
Region - City - Count - Rank
A - m - 30 - 4
A - n - 50 - 2
A - o - 20 - 5
B - x - 80 - 1
B - y - 40 - 3
This Rank for "City" columns created by sql server. (The Biggest "Count" has rank 1 and The Lowset has 5). OK?
Now we are in reporting service. And I grouped this result set for "Region" columns.
Sum of the Regeion "A"=100 & Sum of the Regeion "B"=120.
Now I want Rank this sums(100,120). (The Biggest "Sum" has rank 1 and The Lowset has 2 and etc). OK?
How can I rank this rdl group?
Region - City - Count - Rank
A - m - 30 - 4
A - n - 50 - 2
A - o - 20 - 5
Sum:A - 100 - 2
B - x - 80 - 1
B - y - 40 - 3
Sum:B - 120 - 1
.
.
.Each problem has a solution.
June 24th, 2012 5:35am
Hi There
Thanks for your posting again. As far as I know in SSRS there is no rank function by default. However if you are using SSRS 2008,
to work around this issue you can create another dataset which will take the rank of you count at Region level and then you can use look up function inside your Regional total. So your query might look like this for DataSet2
SELECT [Region]
,sum([COUNT]) as RegionCount,
RANK() OVER ( ORDER BY sum([COUNT])desc ) AS Rank
FROM [dbo].[RankExample]
group by
[Region]
SELECT [Region]
,sum([COUNT]) as RegionCount,
RANK() OVER ( ORDER BY sum([COUNT])desc ) AS RegionalRank
FROM [dbo].[RankExample]
group by
[Region]
Your
look up function inside your Regional total look like this
=cstr(sum(Fields!COUNT.Value)) +"-" +cstr(lookup(Fields!Region.Value,Fields!Region.Value,Fields!RegionalRank.Value, "DataSet2"))
I am putting some screenshot for your help.
If you have any question please let me know.
Many Thanks
Syed Qazafi Anjum
Please click "Mark as Answer" if this resolves your problem or "Vote as Helpful" if you find it helpful.
Free Windows Admin Tool Kit Click here and download it now
June 24th, 2012 4:52pm
Thank you
Syed Qazafi Anjum
Now another question about your help:
How can I call my procedure just one time by both
DataSet?
Because my SP needs 30 secconds for execute.
If I call SP 2 times by
DataSet1 and
DataSet2 It needs 60 Seconds.
How can I call my procedure just one time by both
DataSet?Each problem has a solution.
June 26th, 2012 1:59am