Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

dividing issue in an expression

Posted on 2015-02-04
6
Medium Priority
?
114 Views
Last Modified: 2015-02-05
=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
Comment
Question by:vbnetcoder
  • 3
  • 2
6 Comments
 
LVL 66

Expert Comment

by:Jim Horn
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
integer-math.jpgTo 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

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

Expert Comment

by:Jim Horn
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
Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

 

Author Comment

by:vbnetcoder
ID: 40589800
That didn't work
0
 
LVL 52

Accepted Solution

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

Open in new window

0
 

Author Closing Comment

by:vbnetcoder
ID: 40590764
ty
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hi All, I am here to write a simple article to move SSRS (SQL Server Reporting Services) reports from one server to another. When I have faced the same issue to move reports those were developed by developer on development server and now need to …
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…
Screencast - Getting to Know the Pipeline
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…

879 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question