SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Analysis Server and Reporting Services (2008)
 Avg expression
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

sz1
Constraint Violating Yak Guru

United Kingdom
441 Posts

Posted - 12/11/2012 :  08:41:26  Show Profile  Reply with Quote
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

Edited by - sz1 on 12/11/2012 09:34:25

sunitabeck
Flowing Fount of Yak Knowledge

5155 Posts

Posted - 12/11/2012 :  10:09:19  Show Profile  Reply with Quote
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
Constraint Violating Yak Guru

United Kingdom
441 Posts

Posted - 12/11/2012 :  10:37:17  Show Profile  Reply with Quote
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

Edited by - sz1 on 12/11/2012 10:52:11
Go to Top of Page

sz1
Constraint Violating Yak Guru

United Kingdom
441 Posts

Posted - 12/11/2012 :  11:21:12  Show Profile  Reply with Quote
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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000