Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Analysis Server and Reporting Services (2008)
 Avg expression

Author  Topic 

sz1
Aged Yak Warrior

555 Posts

Posted - 2012-12-11 : 08:41:26
Hi

I'm trying to do a simple average in an expression: I want only to return the average percent of calls where STATUS_NAME = awaiting information, so the percentage of of all calls with awaiting information from the total calls. Here's what I have, I want to see the percent of waiting information against all calls...the below returns a 0??

Any help appreciated.


=Sum(IIF(Fields!STATUS_NAME.Value = "Awaiting Information",1,0),"OpenCalls_24_0")/Count(Fields!id.Value, "OpenCalls_24_0")
help appreciated

Thanks

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2012-12-11 : 10:09:19
Could be because of integer division - you can test that hypothesis as follows:

=Sum(IIF(Fields!STATUS_NAME.Value = "Awaiting Information",CDbl(1),CDbl(0)),"OpenCalls_24_0")
/
CDbl(Count(Fields!id.Value, "OpenCalls_24_0")
Go to Top of Page

sz1
Aged Yak Warrior

555 Posts

Posted - 2012-12-11 : 10:37:17
Hi

That also returns a 0. Any other way I can get the percentage of this?

error

System.Web.Services.Protocols.SoapException: The Value expression for the textrun ‘Textbox13.Paragraphs[0].TextRuns[0]’ contains an error: [BC30198] ')' expected.


also strange that this returns all tickets and not just a count of awaiting information?

=count(IIF(Fields!STATUS_NAME.Value = "Awaiting Information",1,0),"OpenCalls_24_0"))

Any ideas?

Thanks
Go to Top of Page

sz1
Aged Yak Warrior

555 Posts

Posted - 2012-12-11 : 11:21:12
Hi

got around this by adding the expression to a table instead of a text box with this
=sum(IIF(Fields!STATUS_NAME.Value = "Awaiting information",1,0)/count(Fields!id.Value))

strange where there should be a dot I have a comma like this 51,25% even after formatting, can this be changed??

Thanks
Go to Top of Page
   

- Advertisement -