Solved

# dividing issue in an expression

Posted on 2015-02-04
95 Views
=Sum(Fields!TotalDays.Value, "dsTotalDays") \ Sum(Fields!DocumentCount.Value, "dsDocumentCont")

Where total days = 14

document count = 5

is returning and even 2 how do i get decimals?
0
Question by:vbnetcoder
• 3
• 2

LVL 65

Expert Comment

ID: 40589736
What you are experiencing is referred to as 'integer math', where SQL Server will process two integer numbers in a divide option and return a value of an integer, e.g. 9 / 2 = 4 instead of 4.5
To get a return value with decimal places, then you'll have to convert one of the values in the division to contain decimal values.
0

Author Comment

ID: 40589758
how would i do this in SSRS using the expression i posted?
0

LVL 65

Expert Comment

ID: 40589770
I don't have a picture handy, but it'll likely be as simple as using a function that converts to a data type that supports decimal values, such as CDbl(), CSng(), etc.

=Sum(Fields!TotalDays.Value, "dsTotalDays") \ CSng(Sum(Fields!DocumentCount.Value, "dsDocumentCont"))
0

Author Comment

ID: 40589800
That didn't work
0

LVL 45

Accepted Solution

Vitor Montalvão earned 500 total points
ID: 40590551
Change the operator (\ for /):
``````=Sum(Fields!TotalDays.Value, "dsTotalDays") / Sum(Fields!DocumentCount.Value, "dsDocumentCont")
``````
0

Author Closing Comment

ID: 40590764
ty
0

## Featured Post

### Suggested Solutions

Introduction As you'll probably know, a data region in a SQL Server Reporting Services report can be linked to only one dataset.  This makes it troublesome when you need to display data from more than one dataset in the same data region.  SQL Serve…
It is helpful to note: This is a cosmetic update and is not required, but should help your reports look better for your boss.  This issue has manifested itself in SSRS version 3.0 is where I have seen this behavior in.  And this behavior is only see…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…