REW
REW

Reputation: 776

SSRS rounds to whole numbers, but includes 2 decimal places

I have some SQL, of which the part in question is:

sum(Minutes)/60.0 Hrs

In SQL Server Management Studio, my database returns:

14.500000

In SSRS, my report displays:

14.00

My RDL's cell that displays this value has this definition:

=Fields!Hrs.Value

The cell's textbox properties have been defined as a Number, no checkboxes selected, 2 decimal points.

So, the question is, why is my report only outputting 14.00 rather than 14.50 and how can I fix it?

Edit: It may be worth mentioning that the cell data is strangely left-justified, despite not having told it to justify.

Upvotes: 1

Views: 15093

Answers (3)

J_P
J_P

Reputation: 781

If you edit the textbox properties of the cell, and after selecting the type number, you change decimals two zero it should work regardless of the content of the cell. Like this: enter image description here

Upvotes: 0

Spegah
Spegah

Reputation: 11

I think you are using CInt instead of CDbl which will always try to return an integer. Hence the .00 at the end of your expression. Try:

=Format(CDbl(Fields!myFields.Value),"F2")

Upvotes: 1

Sonam
Sonam

Reputation: 3466

Try changing its definition to this:

=Format(CDbl(Fields!myFields.Value),"00.00")

Upvotes: 1

Related Questions