Cascading CASE WHEN in computed column

Salbrox

Registered User.
Local time
Today, 08:35
Joined
Nov 10, 2012
Messages
49
Hi folks,

I have an annoying issue which i cant see the solution to so any help is much appreciated.

I have a table with a number of columns. Most of the columns are computed columns, from the 3rd column on my formula is causing the error "Error validating the formula for column "Quotation Received From Vendor".

Code:
case when [Issue Technical Package Actual] IS NULL then 
	dateadd(day,-81,dateadd(day, -[LEAD_TIME]*(7),[FIELD_NEED_DATE])) 
else 
	[Issue Technical Package Actual] 
end
Code:
case when [RFQ Issued to Vendor Actual] IS NULL then 
	case when [Issue Technical Package Actual] IS NULL then 
		dateadd(day,-74,dateadd(day, -[LEAD_TIME]*(7),[FIELD_NEED_DATE])) 
	else 
		dateadd(day,7,[Issue Technical Package Actual]) 
	end 
else 
	[RFQ Issued to Vendor Actual] 
end
Code:
case when [Quotation Received From Vendor Actual] IS NULL then 
	case when [RFQ Issued to Vendor Actual] IS NULL then 
		case when [Issue Technical Package Actual] IS NULL then
			dateadd(day,-60,dateadd(day, -[LEAD_TIME]*(7),[FIELD_NEED_DATE])) 
		else 
			dateadd(day,21,[Issue Technical Package Actual)
		end 
	else
		dateadd(day,14,[RFQ Issued to Vendor Actual]) 
	end
else 
	[Quotation Received From Vendor Actual] 
end

So the top two work perfectly. The 3rd column gives me an error and will not save. Im not pasting them in as is im (obviously) pasting them from my editor as single lines.

Any help appreciated!
 
Last edited:
You missed a closing bracket here:

dateadd(day,21,[Issue Technical Package Actual])

See if that's all it is.
 
Omg I'm so blind. Thank you. I think that's it! I'll check when I get into the office.

If that's all it is then I'm a blind fool!
 
Happy to help! In my experience, once your eye misses something like that, you can look at it all day long and never see it. Sometimes we just need another pair of eyes.
 
That was it!

Just got into work and tested it a minute ago. I can't believe i didn't spot that!

Thanks pbaldy!
 

Users who are viewing this thread

Back
Top Bottom