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
 General SQL Server Forums
 New to SQL Server Programming
 SQL Layout view issue

Author  Topic 

midpenntech
Posting Yak Master

137 Posts

Posted - 2008-05-14 : 11:19:56
I have a report that i have totaled and working correctly and I am able to get the 2 columns to sum up but I need to get those 2 sumed columns to be divided to get the gross prof %.

The columns that I have summed are
=Sum(Fields!eqpsldamt.Value)
=Sum(Fields!grosspro.Value)

I need to take those summed values and divide them but I do not know the propper syntax to do this. I thought it would have been
=SUM(Fields!grosspro.Value) / SUM(eqpsldamt.Value)

But this did not work any help would be great thanks!

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-05-14 : 11:22:51
Use:-
=IIF(Sum(Fields!eqpsldamt.Value)>0,Sum(Fields!grosspro.Value)/Sum(Fields!eqpsldamt.Value),0)
Go to Top of Page

midpenntech
Posting Yak Master

137 Posts

Posted - 2008-05-14 : 12:18:41
Sorry about the double post but I tried the =IF(Sum(Fields!eqpsldamt.Value)>0,Sum(Fields!grosspro.Value)/Sum(Fields!eqpsldamt.Value),0)

this did not work
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-05-14 : 12:23:43
quote:
Originally posted by midpenntech

Sorry about the double post but I tried the =IFIIF(Sum(Fields!eqpsldamt.Value)>0,Sum(Fields!grosspro.Value)/Sum(Fields!eqpsldamt.Value),0)

this did not work


This is not what i posted. See above. its IIF not IF
Go to Top of Page

midpenntech
Posting Yak Master

137 Posts

Posted - 2008-05-14 : 12:24:59
i tried both and it didnt work i thought that was a miss type.
Go to Top of Page

midpenntech
Posting Yak Master

137 Posts

Posted - 2008-05-14 : 12:27:52
Never mind that actually worked and its posting correctly now i just need to take that result and get it to show in a %
Go to Top of Page

midpenntech
Posting Yak Master

137 Posts

Posted - 2008-05-14 : 12:34:26
any idea how to get it to show up from .083432 to show 8.34%
Go to Top of Page

midpenntech
Posting Yak Master

137 Posts

Posted - 2008-05-14 : 12:39:30
I got it you need to go under format and place .###% and it will format it to display 8.34%
Go to Top of Page

midpenntech
Posting Yak Master

137 Posts

Posted - 2008-05-14 : 12:53:51
just for personal info what would i need to do to get it to show the value for each line. We did the SUM but how would I do it for each line.

=Fields!eqpsldamt.Value
=Fields!grosspro.Value
Would it be =IIF((Fields!eqpsldamt.Value)>0,(Fields!grosspro.Value)/(Fields!eqpsldamt.Value),0)
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-05-14 : 12:59:24
quote:
Originally posted by midpenntech

just for personal info what would i need to do to get it to show the value for each line. We did the SUM but how would I do it for each line.

=Fields!eqpsldamt.Value
=Fields!grosspro.Value
Would it be =IIF((Fields!eqpsldamt.Value)>0,(Fields!grosspro.Value)/(Fields!eqpsldamt.Value),0)


Each line ? didnt get that. Please explain your scenario with some data.
Go to Top of Page

midpenntech
Posting Yak Master

137 Posts

Posted - 2008-05-14 : 13:04:56
Well we first did the SUM expression that you gave me and it works wonderfull. I wanted to see if we can do each field now. see i was doing =SUM(Fields!grosspro.value and =SUM(Fields!eqpsldamt.Value). Now I just want to use just the fields instead of the SUM.

=Fields!grosspro.value
=Fields!eqpsldamt.Value

just like before but with out the SUM of the columns.
EQPSLDAMT Grosspro Gross%(This is the column i would like)
238499.00, 43234.00
583444.03, 62134.00
234518.54, 95783.34

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-05-14 : 13:41:42
Yup. that you can do by this

=IIF(Fields!eqpsldamt.Value>0,Fields!grosspro.Value/Fields!eqpsldamt.Value,0)
Go to Top of Page

midpenntech
Posting Yak Master

137 Posts

Posted - 2008-05-14 : 13:59:00
Thanks for all the help I am sure ill have many more. You have helped out a great deal!
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-05-14 : 14:06:14
quote:
Originally posted by midpenntech

Thanks for all the help I am sure ill have many more. You have helped out a great deal!


No problem. You are always welcome
Go to Top of Page
   

- Advertisement -