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.
Author |
Topic |
osirisa
Constraint Violating Yak Guru
289 Posts |
Posted - 2008-03-17 : 13:00:11
|
Hi group:I have an emergency. I created a report. In the Percentage Column, the below is the correct calculation. However, I need to have a Zero in front of any reasult less than 1.0%.For example 0.47% How can I do that? Help!!!!!! :( =Round((Fields!Net_Receipts.Value-Fields!Deliveries.Value)/Fields!Deliveries.Value*100,2)Thanks |
|
jsmith8858
Dr. Cross Join
7423 Posts |
|
osirisa
Constraint Violating Yak Guru
289 Posts |
Posted - 2008-03-17 : 13:59:05
|
Nope we did not cover this one....and the MSDN does not give me a clear answer...:) |
|
|
jhermiz
3564 Posts |
Posted - 2008-03-19 : 10:22:57
|
quote: Originally posted by osirisa Nope we did not cover this one....and the MSDN does not give me a clear answer...:)
You can try something like this:=IIF(Fields!MyFieldNameHere.Value < 1, "0." & Fields!MyFieldNameHere.Value, Fields!MyFieldNameHere.Value)Weblog -- [url]http://weblogs.sqlteam.com/jhermiz[/url] |
|
|
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
7020 Posts |
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2008-03-19 : 13:04:31
|
quote: Originally posted by jhermiz
quote: Originally posted by osirisa Nope we did not cover this one....and the MSDN does not give me a clear answer...:)
You can try something like this:=IIF(Fields!MyFieldNameHere.Value < 1, "0." & Fields!MyFieldNameHere.Value, Fields!MyFieldNameHere.Value)
Wouldn't you just use a format code? Don't embedd formatting considerations into your expressions when you don't need to. Keep it simple.Set the field to:=Fields!Net_Receipts.Value-Fields!Deliveries.Value / Fields!Deliveries.ValueAnd then right-click on the field, choose Properties, and then go to the Format tab, and enter a format code of:0.00%That's pretty much it. This will round to 2 decimal places and you don't even need to multiply by 100.osirisa -- if you are working with reporting services, you should really brush up completely on the basics such as field formatting. There's even a little HELP button right there on the field properties when you right click. Click HELP and it has all the information you need.- Jeffhttp://weblogs.sqlteam.com/JeffS |
|
|
|
|
|
|
|