SSRS Formula Help

I am attempting to make a change in our Employees Earnings Report. I am adding a text box into the report as a calculated field. I am grabbing the Curhrs field and would like to subtract 40 from the Curhrs amount. In my calculated field I have the expression =Fields!CurHours.Value and it returns the Curhrs value.
So I thought all I had to do is make it =Fields!CurHours.Value-40 to get what I wanted, but I am not getting the results that I expected. So my expression is incorrect. Can anyone point me in the right direction.

As long as that field is part of the Dataset already that should be all that is required.

I have seen this before. My guess is that SSRS is seeing the Fields!CurHours.Value as a string.

Try CDec(Fields!CurHours.Value) - 40

DaveO

Tried your formula but got same results. which were a negative number. Looking at my report I tried changing the -40. I changed it to -10 and I got the correct output. it took the CurHours and subtracted 40 from that total, it just doesn’t make any sense.

Could you include a few screen shots? That helps me to visualize the issue.

Dan,
Output is correct change my formula to -10 instead of -40
my next thing is to total that info
attached is a screen shot

I think I’m misunderstanding something. Your screenshot looks like the math is working out just fine. Your bottom number is 40 less than your top one for each grouping.

Dan,

You are correct. But to get the correct value I put -10 into my expression instead of -40

Original: =Fields!CurHours.Value -40 This returns a value that is -160 from the CurHours field

Currently: =Fields!CurHours.Value -10 This one give me the correct answer of subtracting 40 from the CurHours field.

Just confused why I am not getting the correct value with the original expression

I am having no luck on Totaling my calculated field

Maybe I am just in over my head

Gary

I see, now. That’s wild. I don’t have a good guess as to what is going on. Just for grins and giggles, did you try using CDec(40) when you subtract it? I have no idea why that might do anything but hey, it’s worth a shot.

Dan,

I tried the CDec(40) but that did not give me the correct results

CDec(10) gave me the correct results

I am going to need (2) more things in this report

To total my Calculate field (Minus40)

And not to have “BNS” entries to be displayed in PTDesc Field

Gary

Assuming you’re trying to show hours above 40 for this field?
Are you sure this field is properly within the same report grouping?

@ajr117 You look to be outside the row grouping based on the image.
Also, you should be able to sum (the total) like this using a scope in the SUM function:
=SUM(Fields!Labor.Value,"WeekOfYear")