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)
 Format expression as decimal

Author  Topic 

helixpoint
Constraint Violating Yak Guru

291 Posts

Posted - 2012-06-19 : 09:35:35
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
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2012-06-19 : 10:14:15
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

291 Posts

Posted - 2012-06-19 : 10:30:05
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

291 Posts

Posted - 2012-06-19 : 10:35:42
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
   

- Advertisement -