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)
 Format expression as decimal
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

helixpoint
Constraint Violating Yak Guru

252 Posts

Posted - 06/19/2012 :  09:35:35  Show Profile  Reply with Quote
I do not want commas if the number is above a thousand, but this does not even give me the decimals.

I need it to look like 12345.23

=iif(reportitems!Avail_IN.Value - reportitems!Avail_Out.Value <=0,"$" & FORMAT(reportitems!Avail_IN.Value - reportitems!Avail_Out.Value, "######.##")


Dave
Helixpoint Web Development
http://www.helixpoint.com

sunitabeck
Flowing Fount of Yak Knowledge

5152 Posts

Posted - 06/19/2012 :  10:14:15  Show Profile  Reply with Quote
quote:
Originally posted by helixpoint

I do not want commas if the number is above a thousand, but this does not even give me the decimals.

I need it to look like 12345.23

=iif(reportitems!Avail_IN.Value - reportitems!Avail_Out.Value <=0,"$" & FORMAT(reportitems!Avail_IN.Value - reportitems!Avail_Out.Value, "######.##")


Dave
Helixpoint Web Development
http://www.helixpoint.com

Is that the expression in its entirety? I may be reading it wrong, but you don't seem to have the part that specifies what should happen if the boolean evaluates to false - i.e., if reportitems!Avail_IN.Value - reportitems!Avail_Out.Value is greater than zero.
Go to Top of Page

helixpoint
Constraint Violating Yak Guru

252 Posts

Posted - 06/19/2012 :  10:30:05  Show Profile  Reply with Quote
I am trying..
=iif(reportitems!Avail_IN.Value - reportitems!Avail_Out.Value <=0,"$" & code.DecimalFormat(reportitems!Avail_IN.Value - reportitems!Avail_Out.Value) & "CR" , "$" & code.DecimalFormat(reportitems!Avail_IN.Value - reportitems!Avail_Out.Value))



Public Function DecimalFormat(v as string) As string
return Format(v, "N2")
End Function



quote:
Originally posted by sunitabeck

quote:
Originally posted by helixpoint

I do not want commas if the number is above a thousand, but this does not even give me the decimals.

I need it to look like 12345.23

=iif(reportitems!Avail_IN.Value - reportitems!Avail_Out.Value <=0,"$" & FORMAT(reportitems!Avail_IN.Value - reportitems!Avail_Out.Value, "######.##")


Dave
Helixpoint Web Development
http://www.helixpoint.com

Is that the expression in its entirety? I may be reading it wrong, but you don't seem to have the part that specifies what should happen if the boolean evaluates to false - i.e., if reportitems!Avail_IN.Value - reportitems!Avail_Out.Value is greater than zero.



Dave
Helixpoint Web Development
http://www.helixpoint.com
Go to Top of Page

helixpoint
Constraint Violating Yak Guru

252 Posts

Posted - 06/19/2012 :  10:35:42  Show Profile  Reply with Quote
Got it

Public Function DecimalFormat(v as decimal)As string
return v.ToString("0.00")
End Function

Dave
Helixpoint Web Development
http://www.helixpoint.com
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.08 seconds. Powered By: Snitz Forums 2000