Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Convert Money to decimal

Status
Not open for further replies.
Jul 19, 2003
132
NZ
I'm doing a report where I need to add up values of the datatype Money.

I found it caused errrors so I have converted Money to Decimal in my query CONVERT(Decimal(10,2),Amount) as Amount.

In my report each column is a different Month, so I want to use this logic =Sum(IIF(Fields!Month.Value=7,Fields!Amount.Value,0)), it displays #Error

To my mind this should work, I've done it hundreeds of times before in SSRS and other reporting packages. I can get it to work by using =Sum(Cdec(IIF(Fields!Month.Value=7,Fields!Amount.Value,0))) but i don't see why I should convert to decimal twice, and I expect it's inefficent to convert 50 fields seperately.

I've also tried =Sum(IIF(Fields!Month.Value=7,Fields!Amount.Value,0.00)).

Any ideas what I'm doing wrong?

Thanks.

Bruce
 
i had a similar problem... Try:
Code:
=Sum(IIF(Fields!Month.Value=7,Fields!Amount.Value, CDec("0.00")))

"If I were to wake up with my head sewn to the carpet, I wouldn't be more surprised than I am right now.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top