Percentage
Department finished
Chemical 5
Colorectal 99
Gastroenterology 39
Haematology 68
Liver 16
Lung 15
Renal 84
Respiratory 64
i have a report within SSRS 2005 which contains a table, the first field contains the department field and the second is a sum calculation which is shown below....
=sum(iif(Fields!wait.Value >= 7
and Fields!status.Value <>
"Complete",1,0))
I need to add another column to my table to include the percentage (%) how can i achieve this?
May 19th, 2011 8:56am
I am not sure , percentage of what?
create table #t (depratment varchar(50),finished int)
insert into #t values ('Chemical',5)
insert into #t values ('Colorectal', 99)
insert into #t values ('Gastroenterology', 39)
insert into #t values ('Haematology', 68)
insert into #t values ('Liver', 16)
insert into #t values ('Lung' , 15)
insert into #t values ('Renal', 84)
insert into #t values ('Respiratory' , 64)
select *, 100.*finished / SUM(finished)OVER()per from #t
order by per
Best Regards, Uri Dimant SQL Server MVP http://dimantdatabasesolutions.blogspot.com/ http://sqlblog.com/blogs/uri_dimant/
Free Windows Admin Tool Kit Click here and download it now
May 19th, 2011 9:07am
The percentage calculation is perfect... but i need this incorporated within SSRS as shown in my original post expression
May 19th, 2011 9:18am
Uri Dimant - ive used your example in the dataset... and it works.. but the only problem i am having is to display value correctly...
my example shows 100% which is right but it is displayed as
100.00000000000
how can i fix this... ive tried placing P in the field property but still no luck
May 20th, 2011 10:06am
Hi SQl_1980,
Please try to place P in Format property of the field property.
Free Windows Admin Tool Kit Click here and download it now
May 23rd, 2011 10:15pm
Alternatively to Eileen suggestion you can also use ROUND and CAST functions in the back-end, e.g.
select *, cast(100.*finished / SUM(finished) OVER() as decimal(12,2)) as PercentValue from #t
For every expert, there is an equal and opposite expert. - Becker's Law
My blog
May 24th, 2011 12:09am