SQLTeam.com | Weblogs | Forums

Error while using Multiple IIF conditions in the SSRS expressions


#1

Hello All,
I am using multiple nested IIF conditions in my SSRS reports, but getting an error. Appreciate if anyone can shread some light and fix this;

=IIF((Fields!SDtTm.Value < Fields!SchDt.Value and Fields!Canc.Value = 0, "Orange",
IIF(Fields!SchDt.Value > Now() and Fields!Canc.Value = 1, "Red",
	IIF(Now() > Fields!SchDt.Value and Fields!Canc.Value = 0 and Fields!ActDesc.Value != "Completed",
	"SeaGreen", "Plum")))

#2

You have an extra bracket after the first IIF.

=IIF
(
	Fields!SDtTm.Value < Fields!SchDt.Value and Fields!Canc.Value = 0, 
	"Orange",
	IIF
	(
		Fields!SchDt.Value > Now() and Fields!Canc.Value = 1, 
		"Red",
		IIF
		(
			Now() > Fields!SchDt.Value and Fields!Canc.Value = 0 and Fields!ActDesc.Value != "Completed",
			"SeaGreen", 
			"Plum"
		)
	)
)

#3

Bingo. My bad. Haste makes waste... You are right. An extra parentheses, made all difference. Thanks for pointing out the mistake.
Appreciate it.